在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):HedariKun/DonJS开源软件地址(OpenSource Url):https://github.com/HedariKun/DonJS开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):DonJSDonJS is a javascript library to create Mastodon bots How to start
to visit the documentation click here ExamplesOne of the basic examples on how to use this library is const donjs = require("donjs");
const client = new donjs("your bot token", "your mastodon instance base url");
client.sendStatus("hello world"); This example is to show, how to send hello world status using donjs. you can get the token from Settings -> Development -> create a new application then choose whatever name you want then press Submit -> copy the applications access token. another example that explains how you can listen for the public statuses that people create or delete const donjs = require("donjs");
const client = new donjs("your bot token", "your mastodon instance base url");
client.listenForStatuses();
client.on("onStatus", status => {
console.log("status created!");
});
client.on("onStatusDelete", id => {
console.log("status deleted!");
}); you can also listen for notifications. const donjs = require("donjs");
const client = new donjs("your bot token", "your mastodon instance base url");
client.listenForNotifications();
client.on("onNotification", notification => {
console.log("there is a new notification!");
}); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论