koishi-plugin-cocoyyy-console 1.0.14-beta.7 → 1.0.14

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 +6 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1158,6 +1158,9 @@ async function instead_person(guild_id, source_uid, target_uid) {
1158
1158
  if (!list.includes(source_uid)) {
1159
1159
  throw new Error("not found source_uid in " + guild_id);
1160
1160
  }
1161
+ if (list.includes(target_uid)) {
1162
+ throw new Error("target_uid already in rbqlist");
1163
+ }
1161
1164
  uidList = uidList.replaceAll(source_uid, target_uid);
1162
1165
  existed.set("uid_list", uidList);
1163
1166
  await existed.save();
@@ -1265,6 +1268,9 @@ function registerRbqCommands(ctx, connected) {
1265
1268
  logger.info(`[rbqinstead] info: input_uid: ${session.uid}, sourceId: ${source_uid}, targetId: ${target_uid}, botId: ${session.selfId}`);
1266
1269
  if (target_uid == session.selfId || target_uid == "2440587103") {
1267
1270
  let new_target = session.uid.replace("onebot:", "").toString();
1271
+ if (new_target == source_uid) {
1272
+ return "自救不了一点,乖乖挨草!";
1273
+ }
1268
1274
  exec = await instead_person(session.guildId, source_uid, new_target);
1269
1275
  if (!exec.result)
1270
1276
  return `替换rbq失败:${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-beta.7",
4
+ "version": "1.0.14",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [