Skip to content

Commit 0aed9b9

Browse files
committed
update injection
1 parent 44c2a7d commit 0aed9b9

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

index.ts

+12-13
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,18 @@ global.Hydro.model.luogu = {
4141
export async function apply(ctx: Context) {
4242
ctx.inject(['vjudge'], (c) => {
4343
c.vjudge.addProvider('luogu', LuoguProvider);
44-
});
45-
46-
ctx.on('task/daily', async () => {
47-
const status = await ctx.vjudge.checkStatus();
48-
const id = Object.keys(status).find((k) => k.startsWith('luogu/'));
49-
const quota = status[id].status;
50-
const info = `${quota.orgName} 剩余点数: ${quota.availablePoints}
44+
c.on('task/daily', async () => {
45+
const status = await c.vjudge.checkStatus();
46+
const id = Object.keys(status).find((k) => k.startsWith('luogu/'));
47+
const quota = status[id].status;
48+
const info = `${quota.orgName} 剩余点数: ${quota.availablePoints}
5149
(点数有效期: ${moment(quota.createTime).format('YYYY/MM/DD')}-${moment(quota.expireTime).format('YYYY/MM/DD')})`;
52-
if (moment(quota.expireTime).diff(moment(), 'days') <= 3) {
53-
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数有效期已不足3天,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
54-
}
55-
if (quota.availablePoints > 0 && quota.availablePoints < 1000) {
56-
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数已不足1000,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
57-
}
50+
if (moment(quota.expireTime).diff(moment(), 'days') <= 3) {
51+
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数有效期已不足3天,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
52+
}
53+
if (quota.availablePoints > 0 && quota.availablePoints < 1000) {
54+
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数已不足1000,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
55+
}
56+
});
5857
});
5958
}

0 commit comments

Comments
 (0)