koishi-plugin-lolbaninfo 1.0.1 → 1.1.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/lib/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  import { Context, Schema } from 'koishi';
2
2
  export declare const name = "lolbaninfo";
3
+ export declare const usage = "\n# \u26A0\uFE0F LOL\u5C01\u53F7\u67E5\u8BE2\u63D2\u4EF6 \u26A0\uFE0F\n- **\u6B64\u63D2\u4EF6\u4F5C\u8005\u53EA\u662F\u5236\u4F5C\u5DE5\u5177\uFF0C\u7F51\u7AD9API\u53CA\u5176\u5185\u5BB9\u5747\u4E0E\u4F5C\u8005\u65E0\u5173\uFF0C\u8BF7\u5408\u7406\u4F7F\u7528**\n- \u65E0\u9700\u5BC6\u7801\uFF0C\u76F4\u63A5\u6839\u636EQQ\u53F7\u67E5\u8BE2\u8D26\u53F7\u5C01\u7981\u72B6\u6001\u4E0E\u8BE6\u7EC6\u4FE1\u606F\n\n---\n\n<details>\n<summary><strong><span style=\"font-size: 1.3em; color: #2a2a2a;\">\uD83D\uDCE2 \u529F\u80FD\u7279\u70B9</span></strong></summary>\n\n- \u652F\u6301\u901A\u8FC7QQ\u53F7\u5FEB\u901F\u67E5\u8BE2LOL\u8D26\u53F7\u5C01\u7981\u72B6\u6001\n- \u81EA\u52A8\u91CD\u8BD5\u673A\u5236\uFF0C\u63D0\u9AD8\u67E5\u8BE2\u6210\u529F\u7387\n- \u65E5\u5FD7\u81EA\u52A8\u6E05\u7406\uFF0C\u907F\u514D\u65E5\u5FD7\u8FC7\u591A\u5360\u7528\u5185\u5B58\n- \u7B80\u5355\u6613\u7528\u7684\u6307\u4EE4\u64CD\u4F5C\uFF0C\u9002\u5408\u5404\u7C7B\u7528\u6237\n\n</details>\n\n<details>\n<summary><strong><span style=\"font-size: 1.3em; color: #2a2a2a;\">\uD83D\uDEE0\uFE0F \u914D\u7F6E\u8BF4\u660E</span></strong></summary>\n\n- apiUrl: \u76EE\u6807\u7F51\u7AD9\u7684API\u63A5\u53E3\u5730\u5740\uFF0C\u901A\u5E38\u65E0\u9700\u4FEE\u6539\n- apiToken: \u7F51\u7AD9API\u7684\u8BBF\u95EEToken\uFF08\u6CE8\u518C\u5373\u53EF\u83B7\u5F97\uFF09\uFF0C\u6CE8\u518C\u7F51\u7AD9\uFF1Ahttps://yun.4png.com/\n- retryTimes: \u8BF7\u6C42\u5931\u8D25\u65F6\u7684\u6700\u5927\u91CD\u8BD5\u6B21\u6570\uFF0C\u5EFA\u8BAE\u8BBE\u7F6E\u4E3A2-3\u6B21\n- retryDelay: \u6BCF\u6B21\u91CD\u8BD5\u7684\u95F4\u9694\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C\u5EFA\u8BAE\u8BBE\u7F6E\u4E3A1000-2000ms\n- maxLogCount: \u65E5\u5FD7\u81EA\u52A8\u6E05\u7406\u9608\u503C\uFF08\u6700\u5927\u5B58\u50A8\u6761\u6570\uFF09\uFF0C\u5EFA\u8BAE\u8BBE\u7F6E\u4E3A100-200\u6761\n\n</details>\n\n<details>\n<summary><strong><span style=\"font-size: 1.3em; color: #2a2a2a;\">\uD83D\uDCA1 \u4F7F\u7528\u6307\u4EE4</span></strong></summary>\n\n- \u67E5\u5C01\u53F7+\u7A7A\u683C+<qq\u53F7>\uFF1A\u67E5\u8BE2\u6307\u5B9AQQ\u53F7\u7684LOL\u5C01\u7981\u72B6\u6001\n- \u793A\u4F8B\uFF1A<pre><code>\u67E5\u5C01\u53F7 123456789</code></pre>\n\n</details>\n\n<details>\n<summary><strong><span style=\"font-size: 1.3em; color: #2a2a2a;\">\uD83D\uDCA1 \u4F7F\u7528\u6307\u4EE4</span></strong></summary>\n\n- \u67E5\u5C01\u53F7+\u7A7A\u683C+<qq\u53F7>\uFF1A\u67E5\u8BE2\u6307\u5B9AQQ\u53F7\u7684LOL\u5C01\u7981\u72B6\u6001\n- \u793A\u4F8B\uFF1A<pre><code>\u67E5\u5C01\u53F7 123456789</code></pre>\n\n</details>\n\n<details>\n<summary><strong><span style=\"font-size: 1.3em; color: #2a2a2a;\">\uD83D\uDCC4 \u6CE8\u610F\u4E8B\u9879</span></strong></summary>\n\n- \u8BF7\u786E\u4FDD\u63D0\u4F9B\u7684API Token\u6709\u6548\u4E14\u6709\u67E5\u8BE2\u6743\u9650\n- \u672C\u63D2\u4EF6\u4EC5\u4F9B\u67E5\u8BE2\u5C01\u7981\u72B6\u6001\uFF0C\u8BF7\u52FF\u7528\u4E8E\u5176\u4ED6\u7528\u9014\n\n</details>\n";
4
+ export declare enum ReplyMode {
5
+ MENTION = "mention",// @用户
6
+ QUOTE = "quote",// 引用回复
7
+ NORMAL = "normal"
8
+ }
3
9
  export interface Config {
4
10
  apiUrl: string;
5
11
  apiToken: string;
6
12
  retryTimes: number;
7
13
  retryDelay: number;
8
14
  maxLogCount: number;
15
+ replyMode: ReplyMode;
9
16
  }
10
- export declare const usage = "\n# \u26A0\uFE0F LOL\u5C01\u53F7\u67E5\u8BE2\u63D2\u4EF6 \u26A0\uFE0F\n\u65E0\u9700\u5BC6\u7801\uFF0C\u76F4\u63A5\u6839\u636EQQ\u53F7\u67E5\u8BE2\u8D26\u53F7\u5C01\u7981\u72B6\u6001\u4E0E\u8BE6\u7EC6\u4FE1\u606F\n";
11
17
  export declare const Config: Schema<Config>;
12
18
  export declare function apply(ctx: Context, config: Config): void;
package/lib/index.js CHANGED
@@ -21,21 +21,82 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  Config: () => Config,
24
+ ReplyMode: () => ReplyMode,
24
25
  apply: () => apply,
25
26
  name: () => name,
26
27
  usage: () => usage
27
28
  });
28
29
  module.exports = __toCommonJS(src_exports);
29
30
  var import_koishi = require("koishi");
30
- var import_utils = require("@koishijs/utils");
31
31
  var name = "lolbaninfo";
32
32
  var usage = `
33
33
  # ⚠️ LOL封号查询插件 ⚠️
34
- 无需密码,直接根据QQ号查询账号封禁状态与详细信息
34
+ - **此插件作者只是制作工具,网站API及其内容均与作者无关,请合理使用**
35
+ - 无需密码,直接根据QQ号查询账号封禁状态与详细信息
36
+
37
+ ---
38
+
39
+ <details>
40
+ <summary><strong><span style="font-size: 1.3em; color: #2a2a2a;">📢 功能特点</span></strong></summary>
41
+
42
+ - 支持通过QQ号快速查询LOL账号封禁状态
43
+ - 自动重试机制,提高查询成功率
44
+ - 日志自动清理,避免日志过多占用内存
45
+ - 简单易用的指令操作,适合各类用户
46
+
47
+ </details>
48
+
49
+ <details>
50
+ <summary><strong><span style="font-size: 1.3em; color: #2a2a2a;">🛠️ 配置说明</span></strong></summary>
51
+
52
+ - apiUrl: 目标网站的API接口地址,通常无需修改
53
+ - apiToken: 网站API的访问Token(注册即可获得),注册网站:https://yun.4png.com/
54
+ - retryTimes: 请求失败时的最大重试次数,建议设置为2-3次
55
+ - retryDelay: 每次重试的间隔时间(毫秒),建议设置为1000-2000ms
56
+ - maxLogCount: 日志自动清理阈值(最大存储条数),建议设置为100-200条
57
+
58
+ </details>
59
+
60
+ <details>
61
+ <summary><strong><span style="font-size: 1.3em; color: #2a2a2a;">💡 使用指令</span></strong></summary>
62
+
63
+ - 查封号+空格+<qq号>:查询指定QQ号的LOL封禁状态
64
+ - 示例:<pre><code>查封号 123456789</code></pre>
65
+
66
+ </details>
67
+
68
+ <details>
69
+ <summary><strong><span style="font-size: 1.3em; color: #2a2a2a;">💡 使用指令</span></strong></summary>
70
+
71
+ - 查封号+空格+<qq号>:查询指定QQ号的LOL封禁状态
72
+ - 示例:<pre><code>查封号 123456789</code></pre>
73
+
74
+ </details>
75
+
76
+ <details>
77
+ <summary><strong><span style="font-size: 1.3em; color: #2a2a2a;">📄 注意事项</span></strong></summary>
78
+
79
+ - 请确保提供的API Token有效且有查询权限
80
+ - 本插件仅供查询封禁状态,请勿用于其他用途
81
+
82
+ </details>
35
83
  `;
84
+ var ReplyMode = /* @__PURE__ */ ((ReplyMode2) => {
85
+ ReplyMode2["MENTION"] = "mention";
86
+ ReplyMode2["QUOTE"] = "quote";
87
+ ReplyMode2["NORMAL"] = "normal";
88
+ return ReplyMode2;
89
+ })(ReplyMode || {});
36
90
  var Config = import_koishi.Schema.object({
37
- apiUrl: import_koishi.Schema.string().description("目标网站的API接口地址(固定为文档地址)").default("https://yun.4png.com/api/query.html"),
91
+ apiUrl: import_koishi.Schema.string().description("目标网站的API接口地址").default("https://yun.4png.com/api/query.html "),
38
92
  apiToken: import_koishi.Schema.string().description("网站API的访问Token(注册即可获得)").required(),
93
+ replyMode: import_koishi.Schema.union([
94
+ // 新增配置项
95
+ import_koishi.Schema.const("mention" /* MENTION */).description("使用 @ 用户进行回复"),
96
+ import_koishi.Schema.const("quote" /* QUOTE */).description("使用引用进行回复"),
97
+ import_koishi.Schema.const("normal" /* NORMAL */).description("保持普通回复")
98
+ ]).description("机器人回复消息的方式").default("normal" /* NORMAL */),
99
+ // 默认为普通模式
39
100
  retryTimes: import_koishi.Schema.number().description("请求失败时的最大重试次数").default(2).min(0).max(5),
40
101
  retryDelay: import_koishi.Schema.number().description("每次重试的间隔时间(毫秒)").default(1e3).min(500).max(5e3),
41
102
  maxLogCount: import_koishi.Schema.number().description("日志自动清理阈值(最大存储条数)").default(100).min(20).max(500)
@@ -86,7 +147,7 @@ async function requestWithRetry(ctx, config, qq, logger) {
86
147
  const retryLog = `[准备重试] 间隔${config.retryDelay}ms后进行第${attempt}次重试`;
87
148
  addLogAndClean(logger, retryLog, config.maxLogCount);
88
149
  logger.info(retryLog);
89
- await (0, import_utils.sleep)(config.retryDelay);
150
+ await (0, import_koishi.sleep)(config.retryDelay);
90
151
  }
91
152
  }
92
153
  throw new Error("达到最大重试次数,请求失败");
@@ -96,14 +157,25 @@ function isValidQQ(qq) {
96
157
  return /^\d{5,13}$/.test(qq);
97
158
  }
98
159
  __name(isValidQQ, "isValidQQ");
160
+ function formatReplyMessage(session, message, config) {
161
+ let prefix = "";
162
+ if (config.replyMode === "mention" /* MENTION */) {
163
+ prefix = import_koishi.h.at(session.userId).toString();
164
+ }
165
+ if (config.replyMode === "quote" /* QUOTE */) {
166
+ prefix = import_koishi.h.quote(session.messageId).toString();
167
+ }
168
+ return prefix + message;
169
+ }
170
+ __name(formatReplyMessage, "formatReplyMessage");
99
171
  function apply(ctx, config) {
100
172
  const logger = ctx.logger(name);
101
- ctx.command("查封号 <qq号>", "查询QQ号封号状态").action(async (_, qq) => {
173
+ ctx.command("查封号 <qq号>", "查询QQ号封号状态").action(async ({ session }, qq) => {
102
174
  if (!isValidQQ(qq)) {
103
175
  const errMsg = `QQ号格式错误:${qq}(需5-13位数字)`;
104
176
  addLogAndClean(logger, errMsg, config.maxLogCount);
105
177
  logger.warn(errMsg);
106
- return `❌ ${errMsg}`;
178
+ return formatReplyMessage(session, `❌ ${errMsg}`, config);
107
179
  }
108
180
  try {
109
181
  const result = await requestWithRetry(ctx, config, qq, logger);
@@ -114,25 +186,25 @@ function apply(ctx, config) {
114
186
  const successResLog = `[查询结果] QQ${qq}:${msg} → ${banInfo}`;
115
187
  addLogAndClean(logger, successResLog, config.maxLogCount);
116
188
  logger.success(successResLog);
117
- return `✅ 查询成功:${msg}
118
- 📝 详细信息:${banInfo}`;
189
+ return formatReplyMessage(session, `✅ 查询成功:${msg}
190
+ 📝 详细信息:${banInfo}`, config);
119
191
  case 400:
120
192
  const warnResLog = `[查询结果] QQ${qq} 400错误:${msg}`;
121
193
  addLogAndClean(logger, warnResLog, config.maxLogCount);
122
194
  logger.warn(warnResLog);
123
- return `❌ 查询失败 [错误码400]:${msg}(参数缺失,请检查配置)`;
195
+ return formatReplyMessage(session, `❌ 查询失败 [错误码400]:${msg}(参数缺失,请检查配置)`, config);
124
196
  default:
125
197
  const infoResLog = `[查询结果] QQ${qq} 错误码${result.code}:${msg}`;
126
198
  addLogAndClean(logger, infoResLog, config.maxLogCount);
127
199
  logger.info(infoResLog);
128
- return `❌ 查询失败 [错误码${result.code}]:${msg}`;
200
+ return formatReplyMessage(session, `❌ 查询失败 [错误码${result.code}]:${msg}`, config);
129
201
  }
130
202
  } catch (error) {
131
203
  const errMsg = error.message || "未知错误";
132
204
  const errorLog = `[接口调用出错] QQ${qq}:${errMsg}`;
133
205
  addLogAndClean(logger, errorLog, config.maxLogCount);
134
206
  logger.error(errorLog);
135
- return `⚠️ 接口调用出错:${errMsg}`;
207
+ return formatReplyMessage(session, `⚠️ 接口调用出错:${errMsg}`, config);
136
208
  }
137
209
  });
138
210
  }
@@ -140,6 +212,7 @@ __name(apply, "apply");
140
212
  // Annotate the CommonJS export names for ESM import in node:
141
213
  0 && (module.exports = {
142
214
  Config,
215
+ ReplyMode,
143
216
  apply,
144
217
  name,
145
218
  usage
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-lolbaninfo",
3
3
  "description": "LOL封号查询插件",
4
- "version": "1.0.1",
4
+ "version": "1.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/lenksen/lolbaninfo.git"
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- import{resolveComponent as r,createBlock as a,openBlock as s,withCtx as _,createTextVNode as p}from"vue";const l=(t,e)=>{const o=t.__vccOpts||t;for(const[n,c]of e)o[n]=c;return o},u={};function f(t,e){const o=r("k-layout");return s(),a(o,null,{default:_(()=>[...e[0]||(e[0]=[p("扩展内容",-1)])]),_:1})}const m=l(u,[["render",f]]),x=t=>{t.page({name:"扩展页面",path:"/custom-page",component:m})};export{x as default};
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
-