koishi-plugin-toram 0.2.2-alpha.13 → 0.2.2-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +6 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -37,6 +37,8 @@ async function apply(ctx, config) {
|
|
|
37
37
|
let text;
|
|
38
38
|
let 等级差倍率 = [11, 11, 11, 11, 11, 10, 9, 7, 3];
|
|
39
39
|
ctx.command('组队 <截止时间> <求组内容>').action(async ({ session }, ...args) => {
|
|
40
|
+
const 当前时间date = new Date();
|
|
41
|
+
await ctx.database.remove('toram_team', { until_Unix: { $lte: 当前时间date.getTime() } });
|
|
40
42
|
let 截止时间 = args[0], 组队内容 = args[1];
|
|
41
43
|
let 截止时间_年 = 0;
|
|
42
44
|
if (截止时间 == undefined || 组队内容 == undefined || /^\d+月\d+日(前)?$/.test(截止时间) == false) {
|
|
@@ -49,7 +51,6 @@ async function apply(ctx, config) {
|
|
|
49
51
|
const 截止时间拆分 = 截止时间.split('月');
|
|
50
52
|
const 截止时间_月 = Number(截止时间拆分[0]);
|
|
51
53
|
const 截止时间_日 = Number(截止时间拆分[1].replace('日', ''));
|
|
52
|
-
const 当前时间date = new Date();
|
|
53
54
|
const 当前时间_年 = 当前时间date.getFullYear();
|
|
54
55
|
const 当前时间_月 = 当前时间date.getMonth() + 1;
|
|
55
56
|
const 当前时间_日 = 当前时间date.getDate();
|
|
@@ -77,7 +78,7 @@ async function apply(ctx, config) {
|
|
|
77
78
|
}
|
|
78
79
|
;
|
|
79
80
|
const { nickname } = await session.onebot.getGroupMemberInfo(session.guildId, session.userId, true);
|
|
80
|
-
await ctx.database.upsert('toram_team', [{ id: `${session.guildId}${session.userId}`, form: session.guildId, member_id: session.userId, member_name: nickname,
|
|
81
|
+
await ctx.database.upsert('toram_team', [{ id: `${session.guildId}${session.userId}`, form: session.guildId, member_id: session.userId, member_name: nickname, until_Unix: 截止时间date.getTime(), until_string: 截止时间, content: 组队内容 }]);
|
|
81
82
|
return '成功发布求组信息到组队大厅!';
|
|
82
83
|
});
|
|
83
84
|
ctx.command('组队大厅 [页码]').action(async ({ session }, 输入页码) => {
|
|
@@ -86,7 +87,7 @@ async function apply(ctx, config) {
|
|
|
86
87
|
let 结束索引 = 0;
|
|
87
88
|
let 页码 = 0;
|
|
88
89
|
const 当前时间date = new Date();
|
|
89
|
-
await ctx.database.remove('toram_team', {
|
|
90
|
+
await ctx.database.remove('toram_team', { until_Unix: { $lte: 当前时间date.getTime() } });
|
|
90
91
|
const 本群组队 = await ctx.database.get('toram_team', { form: session.guildId });
|
|
91
92
|
const 本群组队数 = 本群组队.length;
|
|
92
93
|
const 总页数 = Math.max(Math.ceil(本群组队数 / 10), 1);
|
|
@@ -119,6 +120,8 @@ async function apply(ctx, config) {
|
|
|
119
120
|
});
|
|
120
121
|
ctx.command('取消组队').action(async ({ session }) => {
|
|
121
122
|
{
|
|
123
|
+
const 当前时间date = new Date();
|
|
124
|
+
await ctx.database.remove('toram_team', { until_Unix: { $lte: 当前时间date.getTime() } });
|
|
122
125
|
const 删除对象 = await ctx.database.get('toram_team', { id: `${session.guildId}${session.userId}` });
|
|
123
126
|
if (删除对象) {
|
|
124
127
|
await ctx.database.remove('toram_team', { id: 删除对象.id });
|