koishi-plugin-cocoyyy-console 1.0.14-beta.5 → 1.0.14-beta.6
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.js +1 -32
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1143,32 +1143,6 @@ async function get_person_list(guild_id) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
__name(get_person_list, "get_person_list");
|
|
1146
|
-
async function instead_person(guild_id, source_uid, target_uid) {
|
|
1147
|
-
try {
|
|
1148
|
-
const Rbq = getRbqPersonModel();
|
|
1149
|
-
const existed = await findGuildRecord(guild_id);
|
|
1150
|
-
if (!existed) {
|
|
1151
|
-
throw new Error("not found record in " + guild_id);
|
|
1152
|
-
}
|
|
1153
|
-
let uidList = existed.get("uid_list");
|
|
1154
|
-
if (uidList == null) {
|
|
1155
|
-
throw new Error("not found source_uid in " + guild_id);
|
|
1156
|
-
}
|
|
1157
|
-
let list = uidList.split(";");
|
|
1158
|
-
if (!list.includes(source_uid)) {
|
|
1159
|
-
throw new Error("not found source_uid in " + guild_id);
|
|
1160
|
-
}
|
|
1161
|
-
uidList = uidList.replaceAll(source_uid, target_uid);
|
|
1162
|
-
existed.set("uid_list", uidList);
|
|
1163
|
-
await existed.save();
|
|
1164
|
-
personMap.set(guild_id, uidList.split(";"));
|
|
1165
|
-
return { result: true, error: null };
|
|
1166
|
-
} catch (e) {
|
|
1167
|
-
logger.error("[instead_person Error]: " + e?.message || String(e));
|
|
1168
|
-
return { result: false, error: e?.message || String(e) };
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
__name(instead_person, "instead_person");
|
|
1172
1146
|
function get_person_map() {
|
|
1173
1147
|
return personMap;
|
|
1174
1148
|
}
|
|
@@ -1265,14 +1239,9 @@ function registerRbqCommands(ctx, connected) {
|
|
|
1265
1239
|
logger.info(`[rbqinstead] info: input_uid: ${session.uid}, sourceId: ${source_uid}, targetId: ${target_uid}, botId: ${session.selfId}`);
|
|
1266
1240
|
if (target_uid == session.selfId) {
|
|
1267
1241
|
let new_target = session.uid;
|
|
1268
|
-
|
|
1269
|
-
if (!exec.result)
|
|
1270
|
-
return `替换rbq失败:${exec.error}`;
|
|
1242
|
+
logger.info(`[rbqinstead] info: new_target: ${new_target}`);
|
|
1271
1243
|
return "还想让我变rbq?进去吧你,已替换rbq:\n" + (0, import_koishi8.h)("at", { id: source_uid }) + " -> " + (0, import_koishi8.h)("at", { id: new_target });
|
|
1272
1244
|
}
|
|
1273
|
-
exec = await instead_person(session.guildId, source_uid, target_uid);
|
|
1274
|
-
if (!exec.result)
|
|
1275
|
-
return `替换rbq失败:${exec.error}`;
|
|
1276
1245
|
return (0, import_koishi8.h)("p", "已替换rbq:", (0, import_koishi8.h)("at", { id: source_uid }), " -> ", (0, import_koishi8.h)("at", { id: target_uid }));
|
|
1277
1246
|
});
|
|
1278
1247
|
ctx.command("rbqadd_txt <参数>", "添加自定义文本").action(async ({ session }, ...args) => {
|