mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
修复 getGroupMemberInfo 可能报错导致转发异常
This commit is contained in:
parent
fa6a5462e1
commit
3d5bb22f9a
@ -44,7 +44,7 @@ export async function redisSet(userId="all", type = 'bbs', data, time=0) {
|
|||||||
* @param msg 消息
|
* @param msg 消息
|
||||||
*/
|
*/
|
||||||
export async function relpyPrivate(userId, msg) {
|
export async function relpyPrivate(userId, msg) {
|
||||||
userId = Number(userId)
|
userId = Number(userId) || userId
|
||||||
let friend = Bot.fl.get(userId)
|
let friend = Bot.fl.get(userId)
|
||||||
if (friend) {
|
if (friend) {
|
||||||
Bot.logger.mark(`发送好友消息[${friend.nickname}](${userId})`)
|
Bot.logger.mark(`发送好友消息[${friend.nickname}](${userId})`)
|
||||||
@ -54,13 +54,12 @@ export async function relpyPrivate(userId, msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function replyMake(e, _msg, lenght) {
|
export async function replyMake(e, _msg, lenght) {
|
||||||
let nickname = Bot.nickname;
|
const bot = e.bot || Bot
|
||||||
if (e.isGroup) {
|
let nickname = bot.nickname;
|
||||||
if(Bot?.getGroupMemberInfo){
|
if (e.isGroup && bot.getGroupMemberInfo) try {
|
||||||
let info = await Bot?.getGroupMemberInfo(e.group_id, Bot.uin)
|
const info = await bot.getGroupMemberInfo(e.group_id, bot.uin)
|
||||||
nickname = info.card || info.nickname
|
nickname = info.card || info.nickname
|
||||||
}
|
} catch {}
|
||||||
}
|
|
||||||
let msgList = [];
|
let msgList = [];
|
||||||
for (let [index, item] of Object.entries(_msg)) {
|
for (let [index, item] of Object.entries(_msg)) {
|
||||||
if (index < lenght) {
|
if (index < lenght) {
|
||||||
@ -69,7 +68,7 @@ export async function replyMake(e, _msg, lenght) {
|
|||||||
msgList.push({
|
msgList.push({
|
||||||
message: item,
|
message: item,
|
||||||
nickname: nickname,
|
nickname: nickname,
|
||||||
user_id: Bot.uin
|
user_id: bot.uin
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (e.isGroup) {
|
if (e.isGroup) {
|
||||||
@ -139,4 +138,4 @@ export default {
|
|||||||
redisSet,recallMsg,
|
redisSet,recallMsg,
|
||||||
relpyPrivate,
|
relpyPrivate,
|
||||||
getCookieMap
|
getCookieMap
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user