koishi-plugin-iirose-cut 0.0.8 → 0.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/LICENSE +21 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +45 -78
- package/package.json +15 -7
- package/readme.md +1 -1
- package/src/index.ts +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 IIROSE-Plugins
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Context, Schema } from 'koishi';
|
|
2
2
|
export declare const name = "iirose-cut";
|
|
3
|
+
export declare const inject: string[];
|
|
4
|
+
export declare const usage = "\n---\n\nBOT\u9700\u8981\u6709\u623F\u95F4\u6210\u5458\u7684\u661F\u6807\u6743\u9650 / \u7BA1\u7406\u6743\u9650\u3002\n\n\u5982\u679C\u4F60\u7684bot\u6CA1\u6709\u6743\u9650\uFF0C\u5219\u53EF\u4EE5\u53D1\u8D77cut\u6295\u7968\uFF0C\u8BF7\u4F7F\u7528 iirose-self-cut \u63D2\u4EF6\u3002\n\n---\n\n\u4F7F\u7528\u6307\u4EE4\u4EE5\u5207\u6B4C\uFF1A\n\n- iirose.media.cut \uFF1A \u7EC8\u6B62\u5F53\u524D\u6B4C\u66F2\n- iirose.media.cutall \uFF1A \u7EC8\u6B62\u6240\u6709\u6B4C\u66F2\n\n---\n\n\u672C\u63D2\u4EF6\u9700\u8981\u8C03\u7528\u8005\u9700\u8981\u81F3\u5C112\u7EA7\u6743\u9650\u3002\n\n\u5982\u679C\u4F60\u7684\u6743\u9650\u4E0D\u591F\uFF0C\u8BF7\u4F7F\u7528 change-auth-callme \u63D2\u4EF6\u6765\u63D0\u6743\u3002\n\n\u52A1\u5FC5\u4E0D\u8981\u4F7F\u75281\u7EA7\u6743\u9650\uFF0C\u5426\u5219\u53EF\u80FD\u4F1A\u5BFC\u81F4\n\n---\n";
|
|
3
5
|
export interface Config {
|
|
6
|
+
commandAuthority: number;
|
|
4
7
|
}
|
|
5
8
|
export declare const Config: Schema<Config>;
|
|
6
|
-
export declare function apply(ctx: Context): void;
|
|
9
|
+
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
|
@@ -22,96 +22,63 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
Config: () => Config,
|
|
24
24
|
apply: () => apply,
|
|
25
|
-
|
|
25
|
+
inject: () => inject,
|
|
26
|
+
name: () => name,
|
|
27
|
+
usage: () => usage
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(src_exports);
|
|
28
30
|
var import_koishi = require("koishi");
|
|
29
31
|
var name = "iirose-cut";
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
var inject = ["database"];
|
|
33
|
+
var usage = `
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
BOT需要有房间成员的星标权限 / 管理权限。
|
|
37
|
+
|
|
38
|
+
如果你的bot没有权限,则可以发起cut投票,请使用 iirose-self-cut 插件。
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
使用指令以切歌:
|
|
43
|
+
|
|
44
|
+
- iirose.media.cut : 终止当前歌曲
|
|
45
|
+
- iirose.media.cutall : 终止所有歌曲
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
本插件需要调用者需要至少2级权限。
|
|
50
|
+
|
|
51
|
+
如果你的权限不够,请使用 change-auth-callme 插件来提权。
|
|
52
|
+
|
|
53
|
+
务必不要使用1级权限,否则可能会导致
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
`;
|
|
57
|
+
var Config = import_koishi.Schema.object({
|
|
58
|
+
commandAuthority: import_koishi.Schema.number().role("slider").min(0).max(5).step(1).default(2).description("指令权限等级")
|
|
59
|
+
});
|
|
60
|
+
function apply(ctx, config) {
|
|
61
|
+
ctx.command("iirose.media.cut", "终止当前歌曲", { authority: config.commandAuthority }).action(async ({ session }) => {
|
|
62
|
+
if (session.platform !== "iirose") {
|
|
63
|
+
return "暂不支持其他平台。";
|
|
57
64
|
}
|
|
58
|
-
|
|
65
|
+
await session.bot.internal.cutOne();
|
|
66
|
+
return;
|
|
59
67
|
});
|
|
60
|
-
ctx.command("iirose", "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return " [IIROSE-CUT] 该平台不支持使用此插件";
|
|
64
|
-
}
|
|
65
|
-
if (v.options.hasOwnProperty("add")) {
|
|
66
|
-
const at = getAt(v.options.add);
|
|
67
|
-
const index = whiteList.indexOf(at);
|
|
68
|
-
if (index > -1) {
|
|
69
|
-
return "[IIROSE-CUT] 用户已存在白名单";
|
|
70
|
-
}
|
|
71
|
-
whiteList.push(at);
|
|
72
|
-
return "[IIROSE-CUT] 添加白名单成功";
|
|
73
|
-
}
|
|
74
|
-
if (v.options.hasOwnProperty("del")) {
|
|
75
|
-
const at = getAt(v.options.del);
|
|
76
|
-
const index = whiteList.indexOf(at);
|
|
77
|
-
if (index < 0) {
|
|
78
|
-
return "[IIROSE-CUT] 该用户不在白名单中";
|
|
79
|
-
}
|
|
80
|
-
whiteList.splice(index, 1);
|
|
81
|
-
}
|
|
82
|
-
if (v.options.hasOwnProperty("on")) {
|
|
83
|
-
status = true;
|
|
84
|
-
return "[IIROSE-CUT] 自动切歌已启动";
|
|
85
|
-
}
|
|
86
|
-
if (v.options.hasOwnProperty("off")) {
|
|
87
|
-
status = false;
|
|
88
|
-
return "[IIROSE-CUT] 自动切歌已关闭";
|
|
89
|
-
}
|
|
90
|
-
if (v.options.hasOwnProperty("view")) {
|
|
91
|
-
const nowUserListView = "当前房间人员列表:\n" + nowUserList.map((data) => {
|
|
92
|
-
return `
|
|
93
|
-
[*${data}*] `;
|
|
94
|
-
});
|
|
95
|
-
const whiteListView = "当前白名单人员列表:" + whiteList.map((data) => {
|
|
96
|
-
return `
|
|
97
|
-
[*${data}*] `;
|
|
98
|
-
});
|
|
99
|
-
return "[IIROSE-CUT] \n\n" + nowUserListView + "\n\n" + whiteListView;
|
|
68
|
+
ctx.command("iirose.media.cutall", "终止所有歌曲", { authority: config.commandAuthority }).action(async ({ session }) => {
|
|
69
|
+
if (session.platform !== "iirose") {
|
|
70
|
+
return "暂不支持其他平台。";
|
|
100
71
|
}
|
|
72
|
+
await session.bot.internal.cutAll();
|
|
73
|
+
return;
|
|
101
74
|
});
|
|
102
75
|
}
|
|
103
76
|
__name(apply, "apply");
|
|
104
|
-
var getAt = /* @__PURE__ */ __name((message) => {
|
|
105
|
-
const reg = /\[\*([\s\S]+)\*\]/;
|
|
106
|
-
const a = reg.test(message);
|
|
107
|
-
if (!a) {
|
|
108
|
-
return "";
|
|
109
|
-
}
|
|
110
|
-
return message.match(reg)[1];
|
|
111
|
-
}, "getAt");
|
|
112
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
78
|
0 && (module.exports = {
|
|
114
79
|
Config,
|
|
115
80
|
apply,
|
|
116
|
-
|
|
81
|
+
inject,
|
|
82
|
+
name,
|
|
83
|
+
usage
|
|
117
84
|
});
|
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-iirose-cut",
|
|
3
|
-
"description": "适用于的[IIROSE蔷薇花园](https://iirose.com/)
|
|
4
|
-
"version": "0.0.
|
|
3
|
+
"description": "适用于的[IIROSE蔷薇花园](https://iirose.com/)切除退出房间的人所点的歌曲",
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
9
|
-
"
|
|
9
|
+
"src"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/iirose-plugins/koishi-plugin-iirose-cut/issues/new/choose"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/iirose-plugins/koishi-plugin-iirose-cut.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/iirose-plugins/koishi-plugin-iirose-cut",
|
|
12
20
|
"keywords": [
|
|
13
21
|
"chatbot",
|
|
14
22
|
"koishi",
|
|
15
|
-
"plugin"
|
|
23
|
+
"plugin",
|
|
24
|
+
"iirose-cut"
|
|
16
25
|
],
|
|
17
26
|
"peerDependencies": {
|
|
18
|
-
"koishi": "^4.18.7"
|
|
19
|
-
"koishi-plugin-adapter-iirose": "~0.3.63"
|
|
27
|
+
"koishi": "^4.18.7"
|
|
20
28
|
}
|
|
21
|
-
}
|
|
29
|
+
}
|
package/readme.md
CHANGED
package/src/index.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Context, Schema } from 'koishi';
|
|
2
|
+
|
|
3
|
+
export const name = 'iirose-cut';
|
|
4
|
+
|
|
5
|
+
export const inject = ['database'];
|
|
6
|
+
|
|
7
|
+
export const usage = `
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
BOT需要有房间成员的星标权限 / 管理权限。
|
|
11
|
+
|
|
12
|
+
如果你的bot没有权限,则可以发起cut投票,请使用 iirose-self-cut 插件。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
使用指令以切歌:
|
|
17
|
+
|
|
18
|
+
- iirose.media.cut : 终止当前歌曲
|
|
19
|
+
- iirose.media.cutall : 终止所有歌曲
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
本插件需要调用者需要至少2级权限。
|
|
24
|
+
|
|
25
|
+
如果你的权限不够,请使用 change-auth-callme 插件来提权。
|
|
26
|
+
|
|
27
|
+
务必不要使用1级权限,否则可能会导致
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
export interface Config
|
|
33
|
+
{
|
|
34
|
+
commandAuthority: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Config: Schema<Config> = Schema.object({
|
|
38
|
+
commandAuthority: Schema.number().role('slider').min(0).max(5).step(1).default(2).description("指令权限等级"),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function apply(ctx: Context, config: Config)
|
|
42
|
+
{
|
|
43
|
+
ctx
|
|
44
|
+
.command('iirose.media.cut', '终止当前歌曲', { authority: config.commandAuthority })
|
|
45
|
+
.action(async ({ session }) =>
|
|
46
|
+
{
|
|
47
|
+
if (session.platform !== "iirose")
|
|
48
|
+
{
|
|
49
|
+
return "暂不支持其他平台。";
|
|
50
|
+
}
|
|
51
|
+
await session.bot.internal.cutOne();
|
|
52
|
+
return;
|
|
53
|
+
});
|
|
54
|
+
ctx
|
|
55
|
+
.command('iirose.media.cutall', '终止所有歌曲', { authority: config.commandAuthority })
|
|
56
|
+
.action(async ({ session }) =>
|
|
57
|
+
{
|
|
58
|
+
if (session.platform !== "iirose")
|
|
59
|
+
{
|
|
60
|
+
return "暂不支持其他平台。";
|
|
61
|
+
}
|
|
62
|
+
await session.bot.internal.cutAll();
|
|
63
|
+
return;
|
|
64
|
+
});
|
|
65
|
+
}
|