koishi-plugin-cocoyyy-console 1.0.14 → 1.0.15

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.
Files changed (2) hide show
  1. package/lib/index.js +19 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1296,6 +1296,25 @@ function registerRbqCommands(ctx, connected) {
1296
1296
  return `${target_uid}不在当前群聊中`;
1297
1297
  }
1298
1298
  }
1299
+ let user_id = session.uid.replace("onebot:", "").toString();
1300
+ if (user_id == target_uid) {
1301
+ const personMap2 = get_person_map();
1302
+ const rbqList = personMap2.get(session.guildId);
1303
+ if (!rbqList || rbqList.length === 0) return "不能给自己设置文本,请输入其他qq号";
1304
+ if (!rbqList.includes(user_id)) return "不能给自己设置文本,请输入其他qq号";
1305
+ try {
1306
+ const contents = await get_content_list(session.guildId, target_uid);
1307
+ let content2 = "*死你";
1308
+ if (contents && contents.length > 0) {
1309
+ const random = new import_koishi8.Random(() => Math.random());
1310
+ content2 = contents[random.int(0, contents.length)];
1311
+ }
1312
+ return (0, import_koishi8.h)("at", { id: target_uid }) + "还想自己加文本?!\n" + content2;
1313
+ } catch (error) {
1314
+ logger.error("[rbq rbqadd_txt] Error:", error);
1315
+ return "不能给自己设置文本,请输入其他qq号";
1316
+ }
1317
+ }
1299
1318
  let exec = await create_content(session.guildId, content, target_uid);
1300
1319
  if (!exec.result)
1301
1320
  return `添加自定义文本失败:${exec.error}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-cocoyyy-console",
3
3
  "description": "自用koishi插件,功能包含复读,记录黑历史,*人等",
4
- "version": "1.0.14",
4
+ "version": "1.0.15",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [