Commit a572459d authored by nanahira's avatar nanahira

selfid problem

parent f85f6ea5
...@@ -50,7 +50,7 @@ export class Show { ...@@ -50,7 +50,7 @@ export class Show {
if (matchGroup) { if (matchGroup) {
availableBots.push(bot); availableBots.push(bot);
botNameMap.set( botNameMap.set(
bot.selfId, bot.selfId.toString(),
(await bot.$getGroupMemberInfo(this.groupId, bot.selfId)).nickname, (await bot.$getGroupMemberInfo(this.groupId, bot.selfId)).nickname,
); );
} }
...@@ -58,18 +58,18 @@ export class Show { ...@@ -58,18 +58,18 @@ export class Show {
for (const character of this.playbook.characters) { for (const character of this.playbook.characters) {
// exact // exact
let matchBot = availableBots.find( let matchBot = availableBots.find(
(b) => botNameMap.get(b.selfId) === character.name, (b) => botNameMap.get(b.selfId.toString()) === character.name,
); );
// match 1 // match 1
if (!matchBot) { if (!matchBot) {
matchBot = availableBots.find((b) => matchBot = availableBots.find((b) =>
botNameMap.get(b.selfId).includes(character.name), botNameMap.get(b.selfId.toString()).includes(character.name),
); );
} }
// match 2 // match 2
if (!matchBot) { if (!matchBot) {
matchBot = availableBots.find((b) => matchBot = availableBots.find((b) =>
character.name.includes(botNameMap.get(b.selfId)), character.name.includes(botNameMap.get(b.selfId.toString())),
); );
} }
if (matchBot) { if (matchBot) {
......
...@@ -119,7 +119,7 @@ export class MyPlugin { ...@@ -119,7 +119,7 @@ export class MyPlugin {
if (!botId) { if (!botId) {
return `非法指定人物格式: ${specificCharacter}`; return `非法指定人物格式: ${specificCharacter}`;
} }
const bot = bots.find((b) => b.selfId === botId); const bot = bots.find((b) => b.selfId.toString() === botId);
if (!bot) { if (!bot) {
return `没有找到机器人 ${botId}`; return `没有找到机器人 ${botId}`;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment