
npm i qq-group-bot # or yarn add qq-group-bot
const {Bot} = require('qq-group-bot')
const bot = new Bot({
appid: '',
secret: '',
sandbox: true,
removeAt: true,
logLevel: 'info',
maxRetry: 10,
intents: [
'GROUP_AT_MESSAGE_CREATE',
'C2C_MESSAGE_CREATE',
'GUILD_MESSAGES',
'PUBLIC_GUILD_MESSAGES',
'DIRECT_MESSAGE',
'GUILD_MESSAGE_REACTIONS',
'GUILDS',
'GUILD_MEMBERS',
'DIRECT_MESSAGE',
],
})
bot.start()
const {Bot} = require('qq-group-bot')
const bot = new Bot({
})
bot.start().then(() => {
bot.on('message.guild', (e) => {
e.reply('hello world')
})
bot.on('message.direct', (e) => {
e.reply('hello world')
})
bot.on('message.group', (e) => {
e.reply('hello world')
})
bot.on('message.private', (e) => {
e.reply('hello world')
})
bot.sendGuildMessage(channel_id, 'hello')
bot.sendGroupMessage(group_id, 'hello')
bot.sendPrivateMessage(user_id, 'hello')
bot.sendDirectMessage(guild_id, 'hello')
})
| 功能 |
方法名 |
参数1 |
参数2 |
参数3 |
参数4 |
返回值 |
| 获取当前机器人信息 |
getSelfInfo |
|
|
|
|
见获取用户详情 |
| 获取频道列表 |
getGuildList |
|
|
|
|
Guild[] |
| 获取频道详情 |
getGuildInfo |
guild_id |
|
|
|
Guild |
| 获取频道成员列表 |
getGuildMemberList |
guild_id |
|
|
|
Member[] |
| 获取频道成员详情 |
getGuildMemberInfo |
guild_id |
member_id |
|
|
Member |
| 获取子频道列表 |
getChannelList |
guild_id |
|
|
|
Channel[] |
| 获取子频道详情 |
getChannelInfo |
guild_id |
channel_id |
|
|
Channel |
| 发送频道消息 |
sendGuildMessage |
channel_id |
message |
|
|
- |
| 发送频道私信消息 |
sendDirectMessage |
guild_id |
message |
|
|
- |
| 发送群消息 |
sendGroupMessage |
group_id |
message |
|
|
- |
| 发送私信消息 |
sendPrivateMessage |
user_openid |
message |
|
|
- |
| 更多API文档信息待补充 |
|
|
|
|
|
- |