Skip to content

Commit

Permalink
fix:更新版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
CikeyQi committed Dec 2, 2024
1 parent 510dbb7 commit 8fc1051
Show file tree
Hide file tree
Showing 22 changed files with 142 additions and 160 deletions.
2 changes: 1 addition & 1 deletion apps/Challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Challenge extends plugin {
});

for (let i = 0; i < result.length; i++) {
const passTime = result[i].passTime;
const { passTime } = result[i];
const hours = Math.floor(passTime / 3600);
const minutes = Math.floor((passTime % 3600) / 60);
const seconds = passTime % 60;
Expand Down
8 changes: 4 additions & 4 deletions apps/Gacha.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class Gacha extends plugin {
}

if (fs.existsSync(`${_path}/data/wavesGacha/${jsonData.playerId}_Export.json`)) {
const list = JSON.parse(fs.readFileSync(`${_path}/data/wavesGacha/${jsonData.playerId}_Export.json`, 'utf-8')).list;
const { list } = JSON.parse(fs.readFileSync(`${_path}/data/wavesGacha/${jsonData.playerId}_Export.json`, 'utf-8'));

const filteredList = Object.values(list.reduce((acc, item) => {
(acc[item.gacha_id] = acc[item.gacha_id] || []).push(item);
Expand All @@ -213,7 +213,7 @@ export class Gacha extends plugin {
}

fs.writeFileSync(`${_path}/data/wavesGacha/${jsonData.playerId}_Export.json`, JSON.stringify(json, null, 2));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.green(`已写入本地文件 ${jsonData.playerId}_Export.json`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`已将抽卡记录写入本地文件`), logger.green(`${jsonData.playerId}_Export.json`));

return true;
}
Expand Down Expand Up @@ -250,7 +250,7 @@ export class Gacha extends plugin {
try {
await Bot.download(fileUrl, path);
} catch (error) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`文件下载错误${error.stack}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`文件下载错误`), logger.red(error.stack));
await this.reply(`导入抽卡记录失败:${error.message || '未知错误'}`, true);
return true;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ export class Gacha extends plugin {

await this.e.reply(`导入UID为 ${uid} 的抽卡记录成功,共计${json.list.length}条记录`);
await redis.set(`Yunzai:waves:gachaHistory:${this.e.user_id}`, uid);
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.green(`已写入本地文件 ${uid}_Export.json`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`已将抽卡记录写入本地文件`), logger.green(`${uid}_Export.json`));

return true;
}
Expand Down
22 changes: 6 additions & 16 deletions apps/Guide.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class Guide extends plugin {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.yellow(`尝试搜索图鉴:${message}`));
let result = await wiki.search(message)
if (!result.status) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`未能搜索到图鉴内容${message}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`未能搜索到图鉴内容`), logger.red(message));
await e.reply(`未能获取到${message}的图鉴,请检查输入是否正确`)
return false
} else {
Expand Down Expand Up @@ -151,11 +151,9 @@ export class Guide extends plugin {
data.content.modules[1].components[0].tabs[4].content = replace(data.content.modules[1].components[0].tabs[4].content)
data.content.modules[1].components[0].tabs[5].content = replace(data.content.modules[1].components[0].tabs[5].content)

const base64 = await Render.render('Wiki/role/role', {
return await Render.render('Wiki/role/role', {
data,
}, { e: this.e, retType: 'base64' });

return base64
},

wikiWeapon: async (data) => {
Expand All @@ -168,11 +166,9 @@ export class Guide extends plugin {
data.content.modules[0].components[2].content = replace(data.content.modules[0].components[2].content)
data.content.modules[1].components[0].content = replace(data.content.modules[1].components[0].content)

const base64 = await Render.render('Wiki/weapon/weapon', {
return await Render.render('Wiki/weapon/weapon', {
data,
}, { e: this.e, retType: 'base64' });

return base64
},

wikiRelics: async (data) => {
Expand All @@ -184,11 +180,9 @@ export class Guide extends plugin {
data.content.modules[1].components[0].content = replace(data.content.modules[1].components[0].content)
data.content.modules[0].components[1].content = replace(data.content.modules[0].components[1].content)

const base64 = await Render.render('Wiki/relics/relics', {
return await Render.render('Wiki/relics/relics', {
data,
}, { e: this.e, retType: 'base64' });

return base64
},

wikiEnemy: async (data) => {
Expand All @@ -199,11 +193,9 @@ export class Guide extends plugin {
data.content.modules[0].components[0].content = replace(data.content.modules[0].components[0].content)
data.content.modules[0].components[1].tabs[0].content = replace(data.content.modules[0].components[1].tabs[0].content)

const base64 = await Render.render('Wiki/enemy/enemy', {
return await Render.render('Wiki/enemy/enemy', {
data,
}, { e: this.e, retType: 'base64' });

return base64
},

wikiProps: async (data) => {
Expand All @@ -213,11 +205,9 @@ export class Guide extends plugin {

data.content.modules[0].components[0].content = replace(data.content.modules[0].components[0].content)

const base64 = await Render.render('Wiki/props/props', {
return await Render.render('Wiki/props/props', {
data,
}, { e: this.e, retType: 'base64' });

return base64
}
}
}
4 changes: 2 additions & 2 deletions apps/Manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class Manage extends plugin {

await e.reply(imageCard);
} catch (error) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`计算总用户数时出现错误:\n${error}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`计算总用户数时出现错误`), logger.red(error));
await e.reply('[Waves-Plugin] 账号总数\n计算总用户数时出现错误,请检查日志');
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Manage extends plugin {

await e.reply(`[Waves-Plugin] 删除失效账号\n删除了 ${deleted} 个失效账号`);
} catch (error) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`删除失效账号时出现错误:\n${error}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`删除失效账号时出现错误`), logger.red(error));
await e.reply('[Waves-Plugin] 删除失效账号\n删除失效账号时出现错误,请检查日志');
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion apps/News.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class News extends plugin {
return true;
}

const postId = newsData.data.list[0].postId;
const { postId } = newsData.data.list[0];
if (postId != await redis.get(`Yunzai:waves:news`)) {
const limit = pLimit(Config.getConfig().limit);
await Promise.all(autoPushList.map(user =>
Expand Down
14 changes: 7 additions & 7 deletions apps/Sanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ export class Sanity extends plugin {
await Bot[botId]?.pickGroup(groupId).sendMsg([segment.at(userId), data[0].message])
}
return true;
} else {
if (!groupId) {
await Bot[botId]?.pickUser(userId).sendMsg(Bot.makeForwardMsg([{ message: `用户 ${userId}` }, ...data]))
} else {
await Bot[botId]?.pickGroup(groupId).sendMsg(segment.at(userId))
await Bot[botId]?.pickGroup(groupId).sendMsg(Bot.makeForwardMsg([{ message: `用户 ${userId}` }, ...data]))
}
}
else if (!groupId) {
await Bot[botId]?.pickUser(userId).sendMsg(Bot.makeForwardMsg([{ message: `用户 ${userId}` }, ...data]))
}
else {
await Bot[botId]?.pickGroup(groupId).sendMsg(segment.at(userId))
await Bot[botId]?.pickGroup(groupId).sendMsg(Bot.makeForwardMsg([{ message: `用户 ${userId}` }, ...data]))
}
}
return true;
Expand Down
68 changes: 32 additions & 36 deletions apps/Simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,29 @@ export class Simulator extends plugin {
let userData = JSON.parse(await redis.get(`Yunzai:waves:simulator:${type}:${e.user_id}`)) || { five_star_time: 0, five_star_other: true, four_star_time: 0, four_star_other: true };
let { five_star_time, five_star_other, four_star_time, four_star_other } = userData;

if (five_star_time < 70) {
if (Math.random() < data.five_star.basic) {
if (five_star_other) {
if (Math.random() < data.five_star.other) {
gachaData.push({ role: data.five_star.other_pool[Math.floor(Math.random() * data.five_star.other_pool.length)].name, star: 5 });
five_star_other = false
five_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

} else {
gachaData.push({ role: data.five_star.up_pool[Math.floor(Math.random() * data.five_star.up_pool.length)].name, star: 5 });
five_star_other = true
five_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue
}
if (five_star_time < 70 && Math.random() < data.five_star.basic) {
if (five_star_other) {
if (Math.random() < data.five_star.other) {
gachaData.push({ role: data.five_star.other_pool[Math.floor(Math.random() * data.five_star.other_pool.length)].name, star: 5 });
five_star_other = false
five_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

} else {
gachaData.push({ role: data.five_star.up_pool[Math.floor(Math.random() * data.five_star.up_pool.length)].name, star: 5 });
five_star_other = true
five_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

}
} else {
gachaData.push({ role: data.five_star.up_pool[Math.floor(Math.random() * data.five_star.up_pool.length)].name, star: 5 });
five_star_other = true
five_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

}
}

Expand Down Expand Up @@ -89,24 +87,15 @@ export class Simulator extends plugin {

five_star_time++

if (four_star_time < 9) {
if (Math.random() < data.four_star.basic) {
if (four_star_other) {
if (Math.random() < data.four_star.other) {
gachaData.push({ role: data.four_star.other_pool[Math.floor(Math.random() * data.four_star.other_pool.length)].name, star: 4 });
four_star_other = false
four_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

} else {
gachaData.push({ role: data.four_star.up_pool[Math.floor(Math.random() * data.four_star.up_pool.length)].name, star: 4 });
four_star_other = true
four_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

}
if (four_star_time < 9 && Math.random() < data.four_star.basic) {
if (four_star_other) {
if (Math.random() < data.four_star.other) {
gachaData.push({ role: data.four_star.other_pool[Math.floor(Math.random() * data.four_star.other_pool.length)].name, star: 4 });
four_star_other = false
four_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

} else {
gachaData.push({ role: data.four_star.up_pool[Math.floor(Math.random() * data.four_star.up_pool.length)].name, star: 4 });
four_star_other = true
Expand All @@ -115,6 +104,13 @@ export class Simulator extends plugin {
continue

}
} else {
gachaData.push({ role: data.four_star.up_pool[Math.floor(Math.random() * data.four_star.up_pool.length)].name, star: 4 });
four_star_other = true
four_star_time = 0
await redis.set(`Yunzai:waves:simulator:${type}:${e.user_id}`, JSON.stringify({ five_star_time, five_star_other, four_star_time, four_star_other }))
continue

}
}

Expand Down
4 changes: 2 additions & 2 deletions apps/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Task extends plugin {
return { message: `获取帖子失败,无法继续任务` };
}

let postId = postData.data.postList[0].postId;
let { postId } = postData.data.postList[0];
let toUserId = postData.data.postList[0].userId;
let message = `账号 ${account.userId} 的任务结果\n\n`;

Expand Down Expand Up @@ -184,7 +184,7 @@ export class Task extends plugin {
return { message: `获取帖子失败,无法继续任务` };
}

let postId = postData.data.postList[0].postId;
let { postId } = postData.data.postList[0];
let toUserId = postData.data.postList[0].userId;

const signData = await kuro.signIn(account.token);
Expand Down
2 changes: 1 addition & 1 deletion apps/Update.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class Update extends plugin {
* @returns
*/
async makeForwardMsg(title, msg, end) {
let nickname = (this.e.bot ?? Bot).nickname
let { nickname } = this.e.bot ?? Bot
if (this.e.isGroup) {
let info = await (this.e.bot ?? Bot).getGroupMemberInfo(this.e.group_id, (this.e.bot ?? Bot).uin)
nickname = info.card || info.nickname
Expand Down
12 changes: 3 additions & 9 deletions apps/imgUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class ImgUploader extends plugin {
try {
source = (await e[e.isGroup ? 'group' : 'friend']?.getChatHistory(e.isGroup ? e.source?.seq : e.source?.time + 1, 1))?.pop();
} catch (error) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`获取历史消息出错:\n${error}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`获取历史消息出错`), logger.red(error));
}

if (source) {
Expand Down Expand Up @@ -142,7 +142,7 @@ export class ImgUploader extends plugin {
e.isGroup ? e.source.seq : e.source.time + 1, 1
))?.pop();
} catch (error) {
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(`获取历史消息出错:\n${error}`));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`获取历史消息出错`), logger.red(error));
return null;
}
})();
Expand Down Expand Up @@ -241,13 +241,7 @@ export class ImgUploader extends plugin {

return true;
} catch (error) {
const errorMessage = error.response
? `下载文件失败: ${error.response.statusText}`
: error.code === 'ECONNABORTED'
? `下载超时`
: `保存文件失败: ${error.message}`;

logger.mark(logger.blue('[WAVES PLUGIN]'), logger.red(errorMessage));
logger.mark(logger.blue('[WAVES PLUGIN]'), logger.cyan(`下载面板图出错`), logger.red(error));
return false;
}
}
Expand Down
Loading

0 comments on commit 8fc1051

Please sign in to comment.