修复 GSUIDCore 不注册 bot_id
This commit is contained in:
parent
5917fd820c
commit
222239b730
|
@ -478,55 +478,42 @@ class PluginsLoader {
|
|||
|
||||
let { recallMsg = 0, at = "" } = data
|
||||
|
||||
if (at && e.isGroup) {
|
||||
let text = e.sender.card || e.sender.nickname
|
||||
if (text) {
|
||||
text = lodash.truncate(text, { length: 10 })
|
||||
}
|
||||
if (at === true) {
|
||||
if (at) {
|
||||
if (at === true)
|
||||
at = e.user_id
|
||||
|
||||
if (Array.isArray(msg))
|
||||
msg = [segment.at(at), ...msg]
|
||||
else
|
||||
msg = [segment.at(at), msg]
|
||||
}
|
||||
|
||||
if (Array.isArray(msg)) {
|
||||
msg = [segment.at(at, text), ...msg]
|
||||
} else {
|
||||
msg = [segment.at(at, text), msg]
|
||||
}
|
||||
}
|
||||
|
||||
if (quote) {
|
||||
if (Array.isArray(msg)) {
|
||||
if (quote && e.message_id) {
|
||||
if (Array.isArray(msg))
|
||||
msg = [segment.reply(e.message_id), ...msg]
|
||||
} else {
|
||||
else
|
||||
msg = [segment.reply(e.message_id), msg]
|
||||
}
|
||||
}
|
||||
|
||||
let msgRes
|
||||
try {
|
||||
msgRes = await e.replyNew(msg)
|
||||
} catch (err) {
|
||||
if (typeof msg != "string") {
|
||||
if (msg.type == "image" && Buffer.isBuffer(msg?.file))
|
||||
msg.file = {}
|
||||
if (typeof msg != "string")
|
||||
msg = lodash.truncate(JSON.stringify(msg), { length: 300 })
|
||||
}
|
||||
logger.error(`发送消息错误:${msg}`)
|
||||
logger.error(`发送消息错误:${msg}`)
|
||||
logger.error(err)
|
||||
}
|
||||
|
||||
if (recallMsg > 0 && msgRes?.message_id) {
|
||||
if (e.isGroup) {
|
||||
setTimeout(
|
||||
() => e.group.recallMsg(msgRes.message_id),
|
||||
recallMsg * 1000
|
||||
)
|
||||
} else if (e.friend) {
|
||||
setTimeout(
|
||||
() => e.friend.recallMsg(msgRes.message_id),
|
||||
recallMsg * 1000
|
||||
)
|
||||
}
|
||||
if (e.group?.recallMsg)
|
||||
setTimeout(() =>
|
||||
e.group.recallMsg(msgRes.message_id),
|
||||
recallMsg * 1000)
|
||||
else if (e.friend?.recallMsg)
|
||||
setTimeout(() =>
|
||||
e.friend.recallMsg(msgRes.message_id),
|
||||
recallMsg * 1000)
|
||||
}
|
||||
|
||||
this.count(e, msg)
|
||||
|
@ -536,16 +523,17 @@ class PluginsLoader {
|
|||
|
||||
count(e, msg) {
|
||||
let screenshot = false
|
||||
if (msg && msg?.file && Buffer.isBuffer(msg?.file)) {
|
||||
if (msg && msg?.file)
|
||||
screenshot = true
|
||||
}
|
||||
|
||||
this.saveCount("sendMsg")
|
||||
if (screenshot) this.saveCount("screenshot")
|
||||
if (screenshot)
|
||||
this.saveCount("screenshot")
|
||||
|
||||
if (e.group_id) {
|
||||
this.saveCount("sendMsg", e.group_id)
|
||||
if (screenshot) this.saveCount("screenshot", e.group_id)
|
||||
if (screenshot)
|
||||
this.saveCount("screenshot", e.group_id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,9 @@ Bot.adapter.push(new class GSUIDCoreAdapter {
|
|||
}
|
||||
Bot[data.self_id].pickUser = Bot[data.self_id].pickFriend
|
||||
|
||||
if (!Bot.uin.includes(data.self_id))
|
||||
Bot.uin.push(data.self_id)
|
||||
|
||||
logger.mark(`${logger.blue(`[${data.self_id}]`)} ${this.name}(${this.id}) 已连接`)
|
||||
Bot.emit(`connect.${data.self_id}`, Bot[data.self_id])
|
||||
Bot.emit("connect", Bot[data.self_id])
|
||||
|
|
Loading…
Reference in New Issue