Commit c5726a5e authored by nanahira's avatar nanahira

bump to Koishi 4.9.7

parent 3156a183
This diff is collapsed.
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
}, },
"peerDependencies": { "peerDependencies": {
"@koishijs/plugin-adapter-onebot": "^5.0.6", "@koishijs/plugin-adapter-onebot": "^5.3.3",
"koishi": "^4.9.1" "koishi": "^4.9.7"
}, },
"devDependencies": { "devDependencies": {
"@koishijs/plugin-console": "^4.5.4", "@koishijs/plugin-console": "^4.5.4",
"@koishijs/plugin-database-memory": "^1.5.0", "@koishijs/plugin-database-memory": "^1.5.0",
"@koishijs/plugin-sandbox": "^2.2.9", "@koishijs/plugin-sandbox": "^2.2.9",
"@types/jest": "^27.4.0", "@types/jest": "^29.2.0",
"@types/lodash": "^4.14.172", "@types/lodash": "^4.14.172",
"@types/mustache": "^4.1.2", "@types/mustache": "^4.1.2",
"@types/node": "^16.4.11", "@types/node": "^16.4.11",
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"jest": "^27.5.1", "jest": "^29.2.2",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"ts-jest": "^27.1.3", "ts-jest": "^29.0.3",
"ts-loader": "^9.3.1", "ts-loader": "^9.3.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.8.2", "typescript": "^4.8.4",
"webpack": "^5.74.0", "webpack": "^5.74.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",
"ws": "^8.3.0" "ws": "^8.3.0"
......
...@@ -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.toString(), bot.selfId,
(await bot.getGuildMember(this.groupId, bot.selfId)).nickname, (await bot.getGuildMember(this.groupId, bot.selfId)).nickname,
); );
} }
...@@ -64,18 +64,18 @@ export class Show { ...@@ -64,18 +64,18 @@ export class Show {
} }
// exact // exact
let matchBot = availableBots.find( let matchBot = availableBots.find(
(b) => botNameMap.get(b.selfId.toString()) === character.name, (b) => botNameMap.get(b.selfId) === character.name,
); );
// match 1 // match 1
if (!matchBot) { if (!matchBot) {
matchBot = availableBots.find((b) => matchBot = availableBots.find((b) =>
botNameMap.get(b.selfId.toString()).includes(character.name), botNameMap.get(b.selfId).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.toString())), character.name.includes(botNameMap.get(b.selfId)),
); );
} }
if (matchBot) { if (matchBot) {
...@@ -157,7 +157,7 @@ export class Show { ...@@ -157,7 +157,7 @@ export class Show {
([characterId, bot]) => ([characterId, bot]) =>
`${this.playbook.characters `${this.playbook.characters
.find((c) => c.id === characterId) .find((c) => c.id === characterId)
.getDisplayName()} => ${bot.selfId}`, .getDisplayName()} => ${bot.userId}`,
) )
.join('\n'); .join('\n');
} }
......
...@@ -4,7 +4,7 @@ import { Show } from './playbook/Show'; ...@@ -4,7 +4,7 @@ import { Show } from './playbook/Show';
import { Playbook } from './playbook/Playbook'; import { Playbook } from './playbook/Playbook';
import { plainToClass } from 'class-transformer'; import { plainToClass } from 'class-transformer';
import loadJsonFile from 'load-json-file'; import loadJsonFile from 'load-json-file';
import type { OneBotBot } from '@koishijs/plugin-adapter-onebot'; import type OneBotBot from '@koishijs/plugin-adapter-onebot';
export interface PluginConfig { export interface PluginConfig {
autoChangeName?: boolean; autoChangeName?: boolean;
...@@ -116,7 +116,7 @@ export class MyPlugin { ...@@ -116,7 +116,7 @@ export class MyPlugin {
if (!botId) { if (!botId) {
return `非法指定人物格式: ${specificCharacter}`; return `非法指定人物格式: ${specificCharacter}`;
} }
const bot = bots.find((b) => b.selfId.toString() === botId); const bot = bots.find((b) => b.selfId === 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