DoDoJS
DoDoJS 是一个基于 DoDo语音 开发的 NodeJS 机器人框架
安装
npm install dodojs
示例
console.clear();
const Bot = require('dodojs');
(async () => {
const bot = new Bot(
88888888, // 机器人唯一标识
'NjM2OTM0NDg.au-_ve-_vSs.Scs7Y_y8Aw3shbzQ7aUcbz0kAnSsE7pXWHM6Ww6VvNY' // 机器人鉴权Token
);
// 创建会话
await bot.open(() => {
// 个人消息
bot.on('PersonalMessageEvent', async (ctx) => {
/* ctx:
- msg: 消息内容
- dodoId: 用户ID
- messageType: 消息类型
- messageBody: 消息数据
*/
// 回复消息
//await ctx.reply('你发送了消息: ' + ctx.msg);
});
// 频道消息
bot.on('ChannelMessageEvent', async (ctx) => {
/* ctx:
- msg: 消息内容
- dodoId: 用户ID
- islandId: 群聊ID
- channelId: 频道ID
- messageType: 消息类型
- messageBody: 消息数据
- member: 成员信息
- nickName: 成员昵称
- joinTime: 加入时间
- reference: 回复内容
- dodoId: 回复用户ID
- nickName: 回复用户昵称
- messageId: 回复用户消息ID
*/
// 回复消息
//await ctx.reply('你发送了消息: ' + ctx.msg, true);
});
// 消息反应
bot.on('MessageReactionEvent', async (ctx) => {
});
// 成员加入
bot.on('MemberJoinEvent', async (ctx) => {
});
// 成员退出
bot.on('MemberLeaveEvent', async (ctx) => {
});
});
})();