koishi-plugin-ggcevo 1.0.8 → 1.0.9
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 +61 -32
- package/package.json +2 -2
- package/readme.md +12 -3
package/lib/index.js
CHANGED
|
@@ -534,7 +534,8 @@ ${message}
|
|
|
534
534
|
const session = argv.session;
|
|
535
535
|
const handle = await getHandle(session);
|
|
536
536
|
if (!handle) {
|
|
537
|
-
return "
|
|
537
|
+
return `<quote id="${session.messageId}"/>🔒 需要先绑定游戏句柄。
|
|
538
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
538
539
|
}
|
|
539
540
|
const now = /* @__PURE__ */ new Date();
|
|
540
541
|
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
@@ -544,7 +545,7 @@ ${message}
|
|
|
544
545
|
signin_date: { $gte: today }
|
|
545
546
|
});
|
|
546
547
|
if (existingLog) {
|
|
547
|
-
return "
|
|
548
|
+
return `<quote id="${session.messageId}"/>📅 今日已签到,明天再来吧!`;
|
|
548
549
|
}
|
|
549
550
|
const goldReward = Math.floor(Math.random() * 11) + 10;
|
|
550
551
|
let gugubReward = 3;
|
|
@@ -643,7 +644,7 @@ ${message}
|
|
|
643
644
|
message += `
|
|
644
645
|
💰 每月津贴:+${monthlyAllowance} 咕咕币`;
|
|
645
646
|
}
|
|
646
|
-
return message
|
|
647
|
+
return `<quote id="${session.messageId}"/>${message}`;
|
|
647
648
|
});
|
|
648
649
|
ctx.command("ggcevo/兑换 <name:string>").action(async (argv, name2) => {
|
|
649
650
|
const session = argv.session;
|
|
@@ -1218,11 +1219,12 @@ ${message}
|
|
|
1218
1219
|
const session = argv.session;
|
|
1219
1220
|
const handle = await getHandle(session);
|
|
1220
1221
|
if (!handle) {
|
|
1221
|
-
return "
|
|
1222
|
+
return `<quote id="${session.messageId}"/>🔒 需要先绑定游戏句柄。
|
|
1223
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
1222
1224
|
}
|
|
1223
1225
|
const backpackItems = await ctx.database.get("ggcevo_backpack", { user_id: handle });
|
|
1224
1226
|
if (backpackItems.length === 0) {
|
|
1225
|
-
return "
|
|
1227
|
+
return `<quote id="${session.messageId}"/>🎒 背包是空的,快去签到或抽奖获得物品吧!`;
|
|
1226
1228
|
}
|
|
1227
1229
|
let message = `🎒 ${session.username}的背包物品:
|
|
1228
1230
|
`;
|
|
@@ -1232,13 +1234,14 @@ ${message}
|
|
|
1232
1234
|
message += `${itemName} x${item.count}
|
|
1233
1235
|
`;
|
|
1234
1236
|
}
|
|
1235
|
-
return message
|
|
1237
|
+
return `<quote id="${session.messageId}"/>${message}`;
|
|
1236
1238
|
});
|
|
1237
1239
|
ctx.command("ggcevo/个人信息").action(async (argv) => {
|
|
1238
1240
|
const session = argv.session;
|
|
1239
1241
|
const handle = await getHandle(session);
|
|
1240
1242
|
if (!handle) {
|
|
1241
|
-
return "
|
|
1243
|
+
return `<quote id="${session.messageId}"/>🔒 需要先绑定游戏句柄。
|
|
1244
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
1242
1245
|
}
|
|
1243
1246
|
const username = session.username || "未知用户";
|
|
1244
1247
|
let message = `👤 个人信息
|
|
@@ -1335,7 +1338,7 @@ ${message}
|
|
|
1335
1338
|
`;
|
|
1336
1339
|
}
|
|
1337
1340
|
}
|
|
1338
|
-
return message
|
|
1341
|
+
return `<quote id="${session.messageId}"/>${message}`;
|
|
1339
1342
|
});
|
|
1340
1343
|
ctx.command("ggcevo/给予 <targetId> <itemId> <count:number>", { authority: 3 }).action(async (argv, targetId, itemId, count) => {
|
|
1341
1344
|
const session = argv.session;
|
|
@@ -1603,13 +1606,9 @@ ${message}
|
|
|
1603
1606
|
}
|
|
1604
1607
|
message += `─────────────
|
|
1605
1608
|
`;
|
|
1606
|
-
message += `⚠️
|
|
1607
|
-
`;
|
|
1608
|
-
message += `⚠️ 兑换功能仅限工作日使用(周一至周五)
|
|
1609
|
+
message += `⚠️ 兑换功能仅限工作日使用(周一至周五兑换,周六/周日实装进咕咕虫)
|
|
1609
1610
|
`;
|
|
1610
1611
|
message += `⚠️ 兑换完成后请找活动管理员登记
|
|
1611
|
-
`;
|
|
1612
|
-
message += `⚠️ 兑换实装进咕咕虫将在休息日完成(周六/周日)
|
|
1613
1612
|
`;
|
|
1614
1613
|
return message;
|
|
1615
1614
|
});
|
|
@@ -1691,39 +1690,40 @@ ${message}
|
|
|
1691
1690
|
const session = argv.session;
|
|
1692
1691
|
const handle = await getHandle(session);
|
|
1693
1692
|
if (!handle) {
|
|
1694
|
-
return "
|
|
1693
|
+
return `<quote id="${session.messageId}"/>🔒 需要先绑定游戏句柄。
|
|
1694
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
1695
1695
|
}
|
|
1696
1696
|
if (activityId === void 0 || activityId === null) {
|
|
1697
|
-
return
|
|
1697
|
+
return `<quote id="${session.messageId}"/>❌ 请输入活动ID!
|
|
1698
1698
|
使用 活动列表 查询可领取的活动`;
|
|
1699
1699
|
}
|
|
1700
1700
|
const [activity] = await ctx.database.get("ggcevo_activity", { id: activityId });
|
|
1701
1701
|
if (!activity) {
|
|
1702
|
-
return
|
|
1702
|
+
return `<quote id="${session.messageId}"/>❌ 不存在ID为 ${activityId} 的活动!`;
|
|
1703
1703
|
}
|
|
1704
1704
|
const now = /* @__PURE__ */ new Date();
|
|
1705
1705
|
const startTime = new Date(activity.start_time);
|
|
1706
1706
|
const endTime = new Date(activity.end_time);
|
|
1707
1707
|
if (now < startTime) {
|
|
1708
|
-
return
|
|
1708
|
+
return `<quote id="${session.messageId}"/>⏰ 活动尚未开始,开始时间:${startTime.toLocaleString("zh-CN")}`;
|
|
1709
1709
|
}
|
|
1710
1710
|
if (now > endTime) {
|
|
1711
|
-
return
|
|
1711
|
+
return `<quote id="${session.messageId}"/>⏱️ 活动已结束,结束时间:${endTime.toLocaleString("zh-CN")}`;
|
|
1712
1712
|
}
|
|
1713
1713
|
if (activity.required_group && activity.required_group !== "") {
|
|
1714
1714
|
const currentChannelId = session.channelId || session.event?.channel?.id;
|
|
1715
1715
|
if (!currentChannelId) {
|
|
1716
|
-
return
|
|
1716
|
+
return `<quote id="${session.messageId}"/>❌ 无法获取当前群聊信息!`;
|
|
1717
1717
|
}
|
|
1718
1718
|
if (currentChannelId !== activity.required_group) {
|
|
1719
|
-
return
|
|
1719
|
+
return `<quote id="${session.messageId}"/>❌ 该活动仅限在指定群聊内领取!
|
|
1720
1720
|
请前往群聊ID: ${activity.required_group} 领取`;
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
if (activity.max_claims > 0) {
|
|
1724
1724
|
const totalClaims = await ctx.database.get("ggcevo_activity_claim_log", { activity_id: activityId });
|
|
1725
1725
|
if (totalClaims.length >= activity.max_claims) {
|
|
1726
|
-
return
|
|
1726
|
+
return `<quote id="${session.messageId}"/>❌ 该活动领取次数已用尽!`;
|
|
1727
1727
|
}
|
|
1728
1728
|
}
|
|
1729
1729
|
const [existingClaim] = await ctx.database.get("ggcevo_activity_claim_log", {
|
|
@@ -1731,7 +1731,7 @@ ${message}
|
|
|
1731
1731
|
user_id: handle
|
|
1732
1732
|
});
|
|
1733
1733
|
if (existingClaim) {
|
|
1734
|
-
return
|
|
1734
|
+
return `<quote id="${session.messageId}"/>❌ 您已经领取过该活动了!`;
|
|
1735
1735
|
}
|
|
1736
1736
|
await ctx.database.create("ggcevo_activity_claim_log", {
|
|
1737
1737
|
activity_id: activityId,
|
|
@@ -1757,22 +1757,32 @@ ${message}
|
|
|
1757
1757
|
}
|
|
1758
1758
|
}, "updateBackpackItem");
|
|
1759
1759
|
await updateBackpackItem(activity.reward_item, activity.reward_amount);
|
|
1760
|
-
return
|
|
1760
|
+
return `<quote id="${session.messageId}"/>🎉 领取成功!
|
|
1761
1761
|
─────────────
|
|
1762
1762
|
📛 活动:${activity.name}
|
|
1763
1763
|
🎁 获得:${rewardItemName} x${activity.reward_amount}`;
|
|
1764
1764
|
});
|
|
1765
|
-
ctx.command("ggcevo/活动列表").action(async () => {
|
|
1765
|
+
ctx.command("ggcevo/活动列表 [showAll]").action(async (argv, showAll) => {
|
|
1766
1766
|
const activities = await ctx.database.get("ggcevo_activity", {});
|
|
1767
1767
|
if (activities.length === 0) {
|
|
1768
1768
|
return `📋 暂无活动`;
|
|
1769
1769
|
}
|
|
1770
1770
|
const now = /* @__PURE__ */ new Date();
|
|
1771
|
+
const showExpired = !!showAll;
|
|
1772
|
+
const visibleActivities = activities.filter((activity) => {
|
|
1773
|
+
const endTime = new Date(activity.end_time);
|
|
1774
|
+
if (now > endTime && !showExpired) return false;
|
|
1775
|
+
return true;
|
|
1776
|
+
});
|
|
1777
|
+
if (visibleActivities.length === 0) {
|
|
1778
|
+
return `📋 暂无进行中或未开始的活动
|
|
1779
|
+
💡 输入 "活动列表 全部" 可查看包含已过期在内的全部活动`;
|
|
1780
|
+
}
|
|
1771
1781
|
let message = `📋 活动列表
|
|
1772
1782
|
`;
|
|
1773
1783
|
message += `─────────────
|
|
1774
1784
|
`;
|
|
1775
|
-
for (const activity of
|
|
1785
|
+
for (const activity of visibleActivities) {
|
|
1776
1786
|
const startTime = new Date(activity.start_time);
|
|
1777
1787
|
const endTime = new Date(activity.end_time);
|
|
1778
1788
|
const rewardItemName = ItemConfig[activity.reward_item] || "未知物品";
|
|
@@ -2283,31 +2293,50 @@ ${message}
|
|
|
2283
2293
|
return `❌ 同步失败: ${e?.message || e}`;
|
|
2284
2294
|
}
|
|
2285
2295
|
});
|
|
2286
|
-
ctx.command("ggcevo/封禁记录").action(async (argv) => {
|
|
2296
|
+
ctx.command("ggcevo/封禁记录 [user]").usage("不带参数查询自己的封禁记录, 携带 @用户 可查询对方句柄的封禁记录").example("封禁记录, 查询自己的封禁记录\n 封禁记录 @用户, 查询对方句柄的封禁记录").action(async (argv, user) => {
|
|
2287
2297
|
if (!isDocsConfigured()) return "❌ 腾讯文档功能未启用或配置不完整。";
|
|
2288
2298
|
const session = argv.session;
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2299
|
+
let targetHandle;
|
|
2300
|
+
let isOther = false;
|
|
2301
|
+
if (!user) {
|
|
2302
|
+
targetHandle = await getHandle(session);
|
|
2303
|
+
} else {
|
|
2304
|
+
const parsedUser = import_koishi.h.parse(user)[0];
|
|
2305
|
+
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) {
|
|
2306
|
+
return `❌ 参数错误, 请输入"封禁记录 @用户"查询对方的封禁记录。`;
|
|
2307
|
+
}
|
|
2308
|
+
const targetUserId = parsedUser.attrs.id;
|
|
2309
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: targetUserId, isActive: true });
|
|
2310
|
+
if (!profile) {
|
|
2311
|
+
return `❌ 对方暂未绑定游戏句柄。`;
|
|
2312
|
+
}
|
|
2313
|
+
targetHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2314
|
+
isOther = true;
|
|
2315
|
+
}
|
|
2316
|
+
if (!targetHandle) {
|
|
2317
|
+
return `🔒 需要先绑定游戏句柄。
|
|
2318
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
2292
2319
|
}
|
|
2320
|
+
const handle = targetHandle;
|
|
2293
2321
|
const [lastSync] = await ctx.database.get("ggcevo_ban_record", {}, { limit: 1 });
|
|
2294
2322
|
if (!lastSync) {
|
|
2295
|
-
return
|
|
2323
|
+
return `⚠️ 封禁记录尚未同步, 请稍后再试或联系管理员。`;
|
|
2296
2324
|
}
|
|
2297
2325
|
const syncTime = lastSync.update_time;
|
|
2298
2326
|
const allRecords = await ctx.database.get("ggcevo_ban_record", {}, { sort: { id: "asc" } });
|
|
2299
2327
|
const target = normalizeHandle(handle);
|
|
2300
2328
|
const records = allRecords.filter((r) => r.handle && normalizeHandle(r.handle) === target);
|
|
2329
|
+
const ownerLabel = isOther ? "对方句柄" : "句柄";
|
|
2301
2330
|
if (records.length === 0) {
|
|
2302
2331
|
return [
|
|
2303
|
-
`✅
|
|
2332
|
+
`✅ ${ownerLabel} ${handle} 暂无封禁记录。`,
|
|
2304
2333
|
`📊 数据最近同步: ${toBeijingTime(syncTime.toISOString())}`
|
|
2305
2334
|
].join("\n");
|
|
2306
2335
|
}
|
|
2307
2336
|
const formatRecord = /* @__PURE__ */ __name((idx) => {
|
|
2308
2337
|
const r = records[idx];
|
|
2309
2338
|
return [
|
|
2310
|
-
`📋 封禁记录 (${idx + 1}/${records.length})`,
|
|
2339
|
+
`📋 ${ownerLabel}封禁记录 (${idx + 1}/${records.length})`,
|
|
2311
2340
|
`文档行号: ${r.id + 1} 行`,
|
|
2312
2341
|
// id 对应文档行号 (跳过表头)
|
|
2313
2342
|
`句柄: ${r.handle}`,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-ggcevo",
|
|
3
3
|
"description": "GGCEVO 综合插件:星际争霸2游戏句柄绑定 + 签到/抽奖/兑换/背包/活动系统等虚拟物品玩法",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.9",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"koishi": "^4.18.7"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
package/readme.md
CHANGED
|
@@ -73,13 +73,13 @@ npm install koishi-plugin-ggcevo
|
|
|
73
73
|
| `给予 <targetId> <itemId> <count>` | — | 3 | 给予指定用户物品(管理指令) |
|
|
74
74
|
| `抽奖概率` | — | — | 查看各奖池的抽奖概率与保底说明 |
|
|
75
75
|
| `签到奖励` | — | — | 查看签到奖励规则说明 |
|
|
76
|
-
| `兑换列表` | 兑换表 | — |
|
|
76
|
+
| `兑换列表` | 兑换表 | — | 查看可兑换物品列表(含皮肤、宠物、入场特效、角色冠名权、赎罪券及各自兑换券消耗) |
|
|
77
77
|
| `创建活动` | — | 3 | 创建活动。选项:`-n 名称 -d 描述 -r 奖励物品ID -a 数量 -s 开始时间 -e 结束时间 -m 领取上限 -g 限制群聊ID` |
|
|
78
78
|
| `领取活动 [activityId]` | — | — | 领取指定(或最新)活动奖励 |
|
|
79
|
-
|
|
|
79
|
+
| `活动列表 [showAll]` | — | — | 查看活动列表。默认只显示进行中与未开始的活动,携带参数(如"全部")显示含已过期在内的全部活动 |
|
|
80
80
|
| `补签` | — | — | 使用补签券补签漏签的日期 |
|
|
81
81
|
| `使用 <name>` | — | — | 使用指定物品(如赎罪券等) |
|
|
82
|
-
|
|
|
82
|
+
| `封禁记录 [user]` | — | — | 查询封禁记录。不带参数查询自己,携带 @用户 查询对方句柄的封禁记录。每页显示 1 条,支持翻页(回复"下一页/上一页/页码/退出") |
|
|
83
83
|
| `同步封禁记录` | — | 3 | 立即从腾讯文档拉取全量数据并写入数据库(管理员指令) |
|
|
84
84
|
| `同步管理员福利` | — | 3 | 立即从腾讯文档拉取管理员福利表(A列QQ号/B列句柄)全量数据并写入数据库(管理员指令) |
|
|
85
85
|
|
|
@@ -130,6 +130,15 @@ npm install koishi-plugin-ggcevo
|
|
|
130
130
|
|
|
131
131
|
## 更新日志
|
|
132
132
|
|
|
133
|
+
### v1.0.9
|
|
134
|
+
|
|
135
|
+
优化指令交互体验与活动列表过滤。
|
|
136
|
+
|
|
137
|
+
- **活动列表**:新增可选参数 `[showAll]`,默认(不带参数)只显示进行中与未开始的活动,隐藏已过期活动;输入 `活动列表 全部` 可查看含已过期在内的全部活动
|
|
138
|
+
- **封禁记录**:新增可选参数 `[user]`,支持 `@用户` 查询对方句柄的封禁记录;无参数时查询自己当前使用中的句柄
|
|
139
|
+
- **引用消息**:为 `签到`、`背包`、`个人信息`、`领取活动` 指令的所有返回消息添加引用消息效果
|
|
140
|
+
- **兑换列表**:删除"限定物品不可兑换"提示,合并兑换开放时间与实装时间为一条提示
|
|
141
|
+
|
|
133
142
|
### v1.0.8
|
|
134
143
|
|
|
135
144
|
修复腾讯文档单选项下拉框单元格读取为空的问题。
|