2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00

#更新抽卡记录改为合并转发消息发送

This commit is contained in:
Ctrlcvs 2022-09-03 09:57:59 +08:00
parent 991320e75b
commit 33306ecc59
2 changed files with 27 additions and 1 deletions

View File

@ -106,6 +106,12 @@ export async function gclog(e) {
url += `${item}=${postdata[item]}&`
}
e.msg= url.substring(0, url.length - 1);
let sendMsg=[];
e.reply("抽卡记录获取中请稍等...")
e._reply=e.reply;
e.reply = (msg) => {
sendMsg.push(msg)
}
if(isV3){
let gclog= (await import(`file:///${_path}/plugins/genshin/model/gachaLog.js`)).default
await (new gclog(e)).logUrl()
@ -116,6 +122,7 @@ export async function gclog(e) {
e.isPrivate = true;
await bing(e)
}
utils.replyMake(e,sendMsg,1)
let time=(configData.gclogEx||5)*60
redis.set(`xiaoyao:gclog:${e.user_id}`, Math.floor(Date.now()/1000)+time, { //把色图链接写入缓存防止一直色色
EX: time

View File

@ -36,8 +36,27 @@ export async function relpyPrivate (userId, msg) {
})
}
}
export async function replyMake(e,_msg,lenght){
let nickname = Bot.nickname;
if (e.isGroup) {
let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin)
nickname = info.card || info.nickname
}
let msgList=[];
for(let [index,item] of Object.entries(_msg)){
if(index<lenght){
continue;
}
msgList.push({
message: item,
nickname: nickname,
user_id: Bot.uin
})
}
e._reply(await Bot.makeForwardMsg(msgList));
}
export default {
sleepAsync,
randomSleepAsync,
randomSleepAsync,replyMake,
randomString,relpyPrivate
}