Members
types :Array.<string>
- Source:
Type:
- Source:
Type:
sessionKey :string
- Source:
Type:
Methods
sendFriendMessage(messageChain, target) → {RecallableMessage}
- Source:
发送好友消息
Parameters:
| Name |
Type |
Description |
messageChain |
string
|
Array.<MessageChain>
|
MessageChain 数组 |
target |
number
|
发送对象的 qq 号 |
Returns:
-
Type
-
RecallableMessage
sendGroupMessage(messageChain, group) → {RecallableMessage}
- Source:
发送群组消息
Parameters:
| Name |
Type |
Description |
messageChain |
string
|
Array.<MessageChain>
|
MessageChain 数组 |
group |
number
|
发送群组的群号 |
Returns:
-
Type
-
RecallableMessage
sendTempMessage(messageChain, qq, group) → {RecallableMessage}
- Source:
发送临时消息
Parameters:
| Name |
Type |
Description |
messageChain |
string
|
Array.<MessageChain>
|
MessageChain 数组 |
qq |
number
|
临时消息发送对象 QQ 号 |
group |
number
|
所在群号 |
Returns:
-
Type
-
RecallableMessage
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
Buffer
|
ReadStream
|
图片所在路径 |
target |
message
|
MessageTarget
|
发送目标对象 |
Returns:
-
Type
-
RecallableMessage
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
Buffer
|
ReadStream
|
语音所在路径 |
target |
GroupTarget
|
发送目标对象(目前仅支持群组) |
Returns:
-
Type
-
RecallableMessage
sendFlashImageMessage(url, target) → {RecallableMessage}
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
Buffer
|
ReadStream
|
图片所在路径 |
target |
message
|
MessageTarget
|
发送目标对象 |
Returns:
-
Type
-
RecallableMessage
uploadImage(url, target) → {Promise.<{imageId: string, url: string}>}
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
Buffer
|
ReadStream
|
图片所在路径 |
target |
message
|
MessageTarget
|
发送目标对象 |
Returns:
-
Type
-
Promise.<{imageId: string, url: string}>
uploadVoice(url) → {Promise.<{voiceId: string, url: string}>}
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
Buffer
|
ReadStream
|
声音所在路径 |
Returns:
-
Type
-
Promise.<{voiceId: string, url: string}>
- Source:
发送消息给指定好友或群组
Parameters:
| Name |
Type |
Description |
message |
Array.<MessageChain>
|
string
|
要发送的消息 |
target |
message
|
MessageTarget
|
发送目标对象 |
Returns:
-
Type
-
RecallableMessage
sendQuotedFriendMessage(message, target, quote) → {RecallableMessage}
- Source:
发送带引用的好友消息
Parameters:
| Name |
Type |
Description |
message |
Array.<MessageChain>
|
MessageChain 数组 |
target |
number
|
发送对象的 qq 号 |
quote |
number
|
引用的 Message 的 id |
Returns:
-
Type
-
RecallableMessage
sendQuotedGroupMessage(message, qq, quote) → {RecallableMessage}
- Source:
发送带引用的群组消息
Parameters:
| Name |
Type |
Description |
message |
Array.<MessageChain>
|
MessageChain 数组 |
qq |
number
|
发送群组的群号 |
quote |
number
|
引用的 Message 的 id |
Returns:
-
Type
-
RecallableMessage
sendQuotedTempMessage(message, qq, group, quote) → {RecallableMessage}
- Source:
发送带引用的临时消息
Parameters:
| Name |
Type |
Description |
message |
Array.<MessageChain>
|
MessageChain 数组 |
qq |
number
|
临时消息发送对象 QQ 号 |
group |
number
|
所在群号 |
quote |
number
|
引用的 Message 的 id |
Returns:
-
Type
-
RecallableMessage
sendQuotedMessage(message, target) → {RecallableMessage}
- Source:
发送引用消息
Parameters:
| Name |
Type |
Description |
message |
Array.<MessageChain>
|
string
|
要发送的消息 |
target |
message
|
发送目标对象 |
Returns:
-
Type
-
RecallableMessage
sendNudge(qq, group)
- Source:
发送戳一戳消息, 未提供群号时为好友消息
Parameters:
| Name |
Type |
Description |
qq |
number
|
好友或群员的QQ |
group |
number
|
群号 |
reply(replyMsg, srcMsg, quoteopt) → {RecallableMessage}
- Source:
回复一条消息, sendMessage 的别名方法
Parameters:
| Name |
Type |
Attributes |
Description |
replyMsg |
Array.<MessageChain>
|
string
|
|
回复的内容 |
srcMsg |
message
|
MessageTarget
|
|
源消息 |
quote |
boolean
|
<optional>
|
是否引用源消息 |
Returns:
-
Type
-
RecallableMessage
- Source:
引用回复一条消息, sendQuotedMessage 的别名方法
Parameters:
| Name |
Type |
Description |
replyMsg |
Array.<MessageChain>
|
string
|
回复的内容 |
srcMsg |
message
|
MessageTarget
|
源消息 |
Returns:
-
Type
-
RecallableMessage
recall(msg, targetIdopt) → {Promise.<httpApiResponse>}
- Source:
撤回一条消息
Parameters:
| Name |
Type |
Attributes |
Description |
msg |
message
|
number
|
|
要撤回的消息或消息 id |
targetId |
number
|
<optional>
|
(mah >= v2.6.0)撤回消息为消息 id 时, 需提供好友 qq 或群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
getFriendList() → {Promise.<Array.<Friend>>}
- Source:
获取 bot 的好友列表
Returns:
-
Type
-
Promise.<Array.<Friend>>
getGroupList() → {Promise.<Array.<GroupPermissionInfo>>}
- Source:
获取 bot 的群组列表
Returns:
-
Type
-
Promise.<Array.<GroupPermissionInfo>>
getBotProfile() → {Promise.<UserInfo>}
- Source:
获取 bot 资料
Returns:
-
Type
-
Promise.<UserInfo>
getFriendProfile(qq) → {Promise.<UserInfo>}
- Source:
Parameters:
| Name |
Type |
Description |
qq |
number
|
好友的 QQ 号 |
Returns:
-
Type
-
Promise.<UserInfo>
getGroupMemberProfile(group, qq) → {Promise.<UserInfo>}
- Source:
获取群员的个人资料
Parameters:
| Name |
Type |
Description |
group |
number
|
群号 |
qq |
number
|
群员的 QQ 号 |
Returns:
-
Type
-
Promise.<UserInfo>
getMessageById(messageId, target) → {Promise.<{code: (0|5), data: message}>}
- Source:
根据消息 id 获取消息内容
Parameters:
| Name |
Type |
Description |
messageId |
number
|
指定的消息 id |
target |
number
|
好友 QQ 或群号 |
Returns:
-
Type
-
Promise.<{code: (0|5), data: message}>
getGroupMemberList(target) → {Promise.<Array.<GroupMember>>}
- Source:
获取指定群的成员名单
Parameters:
| Name |
Type |
Description |
target |
number
|
指定的群号 |
Returns:
-
Type
-
Promise.<Array.<GroupMember>>
setGroupMute(target, memberId, time) → {Promise.<httpApiResponse>}
- Source:
禁言一位群员(需有相应权限)
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
memberId |
number
|
群员的 qq 号 |
time |
number
|
禁言时间(秒) |
Returns:
-
Type
-
Promise.<httpApiResponse>
setGroupUnmute(target, memberId) → {Promise.<httpApiResponse>}
- Source:
解除一位群员的禁言状态
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
memberId |
number
|
群员的 qq 号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
setGroupMuteAll(target) → {Promise.<httpApiResponse>}
- Source:
设置全体禁言
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
setGroupUnmuteAll(target) → {Promise.<httpApiResponse>}
- Source:
解除全体禁言
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
setGroupKick(target, memberId, msg) → {Promise.<httpApiResponse>}
- Source:
移除群成员
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
memberId |
number
|
群员的 qq 号 |
msg |
string
|
信息 |
Returns:
-
Type
-
Promise.<httpApiResponse>
setGroupConfig(target, config) → {Promise.<httpApiResponse>}
- Source:
修改群设置
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
config |
Partial.<GroupInfo>
|
设置 |
Returns:
-
Type
-
Promise.<httpApiResponse>
setEssence(target, id) → {Promise.<httpApiResponse>}
- Source:
设置群精华消息
Parameters:
| Name |
Type |
Description |
target |
number
|
string
|
GroupTarget
|
要设置的群 |
id |
number
|
精华消息 ID |
Returns:
-
Type
-
Promise.<httpApiResponse>
getGroupConfig(target) → {Promise.<GroupInfo>}
- Source:
获取群设置
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
Returns:
-
Type
-
Promise.<GroupInfo>
setGroupMemberInfo(target, memberId, info) → {Promise.<httpApiResponse>}
- Source:
设置群成员信息
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
memberId |
number
|
群员 qq 号 |
info |
Partial.<GroupMember>
|
信息 |
Returns:
-
Type
-
Promise.<httpApiResponse>
getGroupMemberInfo(target, memberId) → {Promise.<GroupMember>}
- Source:
获取群成员信息
Parameters:
| Name |
Type |
Description |
target |
number
|
群号 |
memberId |
number
|
群员 qq 号 |
Returns:
-
Type
-
Promise.<GroupMember>
quit(target) → {Promise.<httpApiResponse>}
- Source:
BOT 主动离群
Parameters:
| Name |
Type |
Description |
target |
number
|
要离开的群的群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
handleMemberJoinRequest(eventId, fromId, groupId, operate, message) → {Promise.<httpApiResponse>}
- Source:
处理用户入群申请
Parameters:
| Name |
Type |
Description |
eventId |
number
|
入群事件 (memberJoinRequest) ID |
fromId |
number
|
申请入群人 QQ 号 |
groupId |
number
|
申请入群群号 |
operate |
0
|
1
|
2
|
3
|
4
|
响应操作,0同意,1拒绝,2忽略,3拒绝并拉黑,4忽略并拉黑 |
message |
string
|
回复的消息 |
Returns:
-
Type
-
Promise.<httpApiResponse>
handleBotInvitedJoinGroupRequest(eventId, fromId, groupId, operate, message) → {Promise.<httpApiResponse>}
- Source:
处理 BOT 被邀请入群的申请
Parameters:
| Name |
Type |
Description |
eventId |
number
|
被邀请入群事件 (botInvitedJoinGroupRequest) ID |
fromId |
number
|
邀请人群者的 QQ 号 |
groupId |
number
|
被邀请进入群的群号 |
operate |
0
|
1
|
响应的操作类型, 0同意邀请,1拒绝邀请 |
message |
string
|
回复的信息 |
Returns:
-
Type
-
Promise.<httpApiResponse>
handleNewFriendRequest(eventId, fromId, groupId, operate, message) → {Promise.<httpApiResponse>}
- Source:
处理好友申请
Parameters:
| Name |
Type |
Description |
eventId |
number
|
好友申请事件 (newFriendRequest) ID |
fromId |
number
|
申请人 QQ 号 |
groupId |
number
|
申请人如果通过某个群添加好友,该项为该群群号;否则为0 |
operate |
0
|
1
|
2
|
响应操作,0同意,1拒绝,2拒绝并拉黑 |
message |
string
|
回复的消息 |
Returns:
-
Type
-
Promise.<httpApiResponse>
uploadFileAndSend(url, path, targetopt) → {Promise.<httpApiResponse>}
- Source:
上传(群)文件并发送
Parameters:
| Name |
Type |
Attributes |
Description |
url |
string
|
Buffer
|
ReadStream
|
|
文件所在路径或 URL |
path |
string
|
GroupFile
|
|
文件要上传到群文件中的位置(路径) |
target |
number
|
GroupTarget
|
<optional>
|
要发送文件的目标 |
Returns:
-
Type
-
Promise.<httpApiResponse>
getGroupFileList(dir, targetopt, withDownloadInfoopt) → {Promise.<Array.<GroupFile>>}
- Source:
获取群文件指定路径下的文件列表
Parameters:
| Name |
Type |
Attributes |
Description |
dir |
GroupFile
|
string
|
number
|
|
- `GroupFile|string` 要获取的群文件路径对象, 使用 `string` 结果可能不准确
- `number` 获取指定群的群文件根目录 `bot.getGroupFileList(groupId)` |
target |
number
|
string
|
GroupTarget
|
<optional>
|
要获取的群号, `dir` 为 `File` 时可不提供 |
withDownloadInfo |
boolean
|
<optional>
|
是否携带下载信息, 无必要不要携带 |
Returns:
-
Type
-
Promise.<Array.<GroupFile>>
getGroupFileInfo(id, targetopt, withDownloadInfoopt) → {Promise.<GroupFile>}
- Source:
获取群文件指定详细信息
Parameters:
| Name |
Type |
Attributes |
Description |
id |
string
|
GroupFile
|
|
文件唯一 ID 或文件对象 |
target |
number
|
string
|
GroupTarget
|
<optional>
|
要获取的群号 |
withDownloadInfo |
boolean
|
<optional>
|
是否携带下载信息, 无必要不要携带 |
Returns:
-
Type
-
Promise.<GroupFile>
renameGroupFile(id, rename, targetopt) → {Promise.<httpApiResponse>}
- Source:
重命名指定群文件
Parameters:
| Name |
Type |
Attributes |
Description |
id |
string
|
GroupFile
|
|
要重命名的文件唯一 ID 或文件对象 |
rename |
string
|
|
文件的新名称 |
target |
number
|
string
|
GroupTarget
|
<optional>
|
目标群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
moveGroupFile(id, moveTo, targetopt) → {Promise.<httpApiResponse>}
- Source:
移动指定群文件
Parameters:
| Name |
Type |
Attributes |
Description |
id |
string
|
GroupFile
|
|
要移动的文件唯一 ID 或文件对象 |
moveTo |
string
|
GroupFile
|
|
文件的新路径或文件夹对象, 使用 `string` 可能结果不准确 |
target |
number
|
string
|
GroupTarget
|
<optional>
|
目标群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
makeDir(id, directoryName, targetopt) → {Promise.<makeDirResponse>}
- Source:
创建文件夹
Parameters:
| Name |
Type |
Attributes |
Description |
id |
string
|
GroupFile
|
null
|
|
父目录id, 空串或null为根目录 |
directoryName |
string
|
|
新建文件夹名 |
target |
string
|
number
|
<optional>
|
群号 |
Returns:
-
Type
-
Promise.<makeDirResponse>
deleteGroupFile(id, targetopt) → {Promise.<httpApiResponse>}
- Source:
删除指定群文件
Parameters:
| Name |
Type |
Attributes |
Description |
id |
string
|
GroupFile
|
|
要删除的文件唯一 ID |
target |
number
|
string
|
GroupTarget
|
<optional>
|
目标群号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
deleteFriend(qq) → {Promise.<httpApiResponse>}
- Source:
删除好友
Parameters:
| Name |
Type |
Description |
qq |
number
|
好友的QQ号 |
Returns:
-
Type
-
Promise.<httpApiResponse>
registerCommand(command) → {Promise.<httpApiResponse>}
- Source:
Parameters:
| Name |
Type |
Description |
command |
Object
|
注册的 command 对象
Properties
| Name |
Type |
Description |
name |
string
|
|
alias |
Array.<string>
|
|
description |
string
|
|
usage |
string
|
|
|
Returns:
-
Type
-
Promise.<httpApiResponse>
sendCommand(command) → {Promise.<httpApiResponse>}
- Source:
Parameters:
| Name |
Type |
Description |
command |
Object
|
发送的 command 对象
Properties
| Name |
Type |
Description |
name |
string
|
|
args |
Array.<string>
|
|
|
Returns:
-
Type
-
Promise.<httpApiResponse>
on(name)
- Source:
事件监听
Parameters:
| Name |
Type |
Description |
name |
N
|
|
|
|
|
onSignal(signalName)
- Source:
订阅 authed, verified, 或 released 信号
Parameters:
| Name |
Type |
Description |
signalName |
"authed"
|
"verified"
|
"released"
|
信号 |
|
|
|
onMessage()
- Source:
订阅消息事件
Parameters:
onEvent(event)
- Source:
Parameters:
| Name |
Type |
Description |
event |
E
|
|
|
|
|
listen()
- Source:
启动事件监听
Parameters:
use(plugin)
- Source:
install plugin
Parameters:
| Name |
Type |
Description |
plugin |
object
|
plugin config
Properties
| Name |
Type |
Attributes |
Description |
name |
string
|
|
unique plugin name |
subscribe |
string
|
<optional>
|
subscribe event name |
callback |
function
|
|
callback function |
|