koishi-plugin-18xx 0.0.3 → 0.0.5
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 +9 -9
- package/package.json +2 -2
package/lib/index.js
CHANGED
@@ -99,7 +99,7 @@ function command(ctx, config) {
|
|
99
99
|
if (!found) return "";
|
100
100
|
}
|
101
101
|
}, "checkSessionMiddleware");
|
102
|
-
ctx.command("18xx.bind <id>", "
|
102
|
+
ctx.command("18xx.bind <id>", "绑定账号").usage("id 是个人资料页地址栏 profile 后面的数字").before(checkSessionMiddleware).action(async ({ session }, id) => {
|
103
103
|
if (Number(id)) {
|
104
104
|
const result = await ctx.database.upsert(name, [
|
105
105
|
{
|
@@ -119,28 +119,28 @@ function command(ctx, config) {
|
|
119
119
|
return "绑定失败";
|
120
120
|
}
|
121
121
|
});
|
122
|
-
ctx.command("18xx.unbind <id>", "
|
122
|
+
ctx.command("18xx.unbind <id>", "取消绑定账号").usage("id 是个人资料页地址栏 profile 后面的数字").action(async ({ session }, id) => {
|
123
123
|
const result = await ctx.database.remove(name, { id: Number(id), userId: session.userId });
|
124
124
|
if (!result.matched) {
|
125
|
-
return "
|
125
|
+
return "你还没有绑定账号";
|
126
126
|
}
|
127
127
|
if (result.removed) {
|
128
128
|
return `${id} 解绑成功`;
|
129
129
|
}
|
130
130
|
return "解绑失败";
|
131
131
|
});
|
132
|
-
ctx.command("18xx.list", "
|
132
|
+
ctx.command("18xx.list", "列出已绑定的账号").alias("18xx.ls").action(async ({ session }) => {
|
133
133
|
const profiles = await ctx.database.get(name, { userId: session.userId });
|
134
134
|
if (!profiles.length) {
|
135
|
-
return "
|
135
|
+
return "你还没有绑定账号";
|
136
136
|
}
|
137
137
|
return `当前已绑定${profiles.length}个账号:
|
138
138
|
${profiles.map((p) => `${p.id}`).join("\n")}`;
|
139
139
|
});
|
140
|
-
ctx.command("18xx.on", "
|
140
|
+
ctx.command("18xx.on", "开启通知").usage("需要先绑定账号,并在个人资料页 webhook_user_id 中填入你的 id").action(async ({ session }) => {
|
141
141
|
const profiles = await ctx.database.get(name, { userId: session.userId });
|
142
142
|
if (!profiles.length) {
|
143
|
-
return "
|
143
|
+
return "你还没有绑定账号";
|
144
144
|
}
|
145
145
|
const result = await ctx.database.upsert(
|
146
146
|
name,
|
@@ -151,10 +151,10 @@ ${profiles.map((p) => `${p.id}`).join("\n")}`;
|
|
151
151
|
}
|
152
152
|
return "通知已开启";
|
153
153
|
});
|
154
|
-
ctx.command("18xx.off", "
|
154
|
+
ctx.command("18xx.off", "关闭通知").action(async ({ session }) => {
|
155
155
|
const profiles = await ctx.database.get(name, { userId: session.userId });
|
156
156
|
if (!profiles.length) {
|
157
|
-
return "
|
157
|
+
return "你还没有绑定账号";
|
158
158
|
}
|
159
159
|
const result = await ctx.database.upsert(
|
160
160
|
name,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "koishi-plugin-18xx",
|
3
3
|
"description": "18xxGames 机器人",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.5",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"typings": "lib/index.d.ts",
|
7
7
|
"files": [
|
@@ -19,7 +19,7 @@
|
|
19
19
|
},
|
20
20
|
"keywords": [
|
21
21
|
"koishi",
|
22
|
-
"
|
22
|
+
"18xx.games",
|
23
23
|
"webhook"
|
24
24
|
],
|
25
25
|
"devDependencies": {
|