kokkoro-plugin-kfc 2.0.0 → 3.0.0
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/LICENSE +1 -1
- package/README.md +17 -23
- package/package.json +17 -12
- package/src/index.ts +19 -15
- package/lib/index.js +0 -12
- package/tsconfig.json +0 -13
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
# kokkoro-plugin-kfc
|
|
2
|
-
|
|
3
|
-
vivo 50
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
**Command:**
|
|
20
|
-
|
|
21
|
-
格式:`/疯狂星期四`
|
|
22
|
-
场景:群聊 & 频道
|
|
23
|
-
功能:随机输出肯德基疯狂星期四段子
|
|
1
|
+
# kokkoro-plugin-kfc
|
|
2
|
+
|
|
3
|
+
vivo 50
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
bun add kokkoro-plugin-kfc
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 指令
|
|
12
|
+
|
|
13
|
+
发送「/疯狂星期四」,插件会随机返回一条疯狂星期四文案。
|
|
14
|
+
|
|
15
|
+
## 快捷方式
|
|
16
|
+
|
|
17
|
+
消息中出现「周四」「星期四」「木曜日」「肯德基」「KFC」「V我50」「微我五十」「vivo50」或「Thursday」等常见说法时,也会触发插件。
|
package/package.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokkoro-plugin-kfc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "vivo 50",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"typings": "lib/index.d.ts",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"bot",
|
|
10
7
|
"kokkoro",
|
|
11
8
|
"kfc",
|
|
12
9
|
"qq"
|
|
13
10
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
11
|
+
"bugs": "https://github.com/kokkorojs/kokkoro/issues",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/kokkorojs/kokkoro.git",
|
|
15
|
+
"directory": "plugins/kfc"
|
|
18
16
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Yuki <admin@yuki.sh>",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": "./src/index.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@kokkoro/core": "^3.1.3",
|
|
26
|
+
"typescript": "^6.0.3"
|
|
22
27
|
}
|
|
23
|
-
}
|
|
28
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCommand } from '@kokkoro/core';
|
|
2
2
|
|
|
3
|
-
interface
|
|
4
|
-
success: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface CrazyThursday {
|
|
4
|
+
readonly success: boolean;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly text: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const KFC_API = new URL('https://kfc.yuki.sh');
|
|
10
|
+
|
|
11
|
+
export default () => {
|
|
12
|
+
useCommand('/疯狂星期四', async () => {
|
|
13
|
+
const response = await fetch(KFC_API);
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const { success, message, text } =
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new Error(`接口请求失败,状态码 ${response.status}`);
|
|
17
|
+
}
|
|
18
|
+
const { success, message, text } = <CrazyThursday>await response.json();
|
|
18
19
|
|
|
19
20
|
return success ? text : message;
|
|
20
|
-
})
|
|
21
|
-
|
|
21
|
+
})
|
|
22
|
+
.shortcut(/(?:vivo|[v微]\s*(?:我|me)?)\s*(?:50|五十)/i)
|
|
23
|
+
.shortcut(/(?:肯德基|kfc)/i)
|
|
24
|
+
.shortcut(/(?:周四|星期四|木曜日|thursday)/i);
|
|
25
|
+
};
|
package/lib/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useCommand } from '@kokkoro/core';
|
|
2
|
-
export const metadata = {
|
|
3
|
-
name: 'kfc',
|
|
4
|
-
description: 'vivo 50',
|
|
5
|
-
};
|
|
6
|
-
export default function KentuckyFriedChicken() {
|
|
7
|
-
useCommand('/疯狂星期四', async (ctx) => {
|
|
8
|
-
const { data } = await ctx.bot.request.get('https://kfc.yuki.sh');
|
|
9
|
-
const { success, message, text } = data;
|
|
10
|
-
return success ? text : message;
|
|
11
|
-
});
|
|
12
|
-
}
|