Commit b177cbbf authored by nanahira's avatar nanahira

add confirmation

parent f9704ef7
......@@ -12,7 +12,8 @@
"source-map-support": "^0.5.20"
},
"devDependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.3",
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.4",
"@koishijs/plugin-onebot": "^4.0.0-alpha.8",
"@types/node": "^16.10.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
......@@ -30,7 +31,7 @@
},
"peerDependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.3",
"koishi": "^4.0.0-beta.4"
"koishi": "^4.0.0-beta.5"
}
},
"node_modules/@babel/code-frame": {
......@@ -225,16 +226,29 @@
}
},
"node_modules/@koishijs/plugin-adapter-onebot": {
"version": "4.0.0-beta.3",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.3.tgz",
"integrity": "sha512-6UWO5qBRHk95UxSfHmPkuwQuAWeLL6T9YnIMlvg9d1EzTQHJWv66FkK4EdJ7Yfs0DoLdFodZ67eLCP707oeYNA==",
"version": "4.0.0-beta.4",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.4.tgz",
"integrity": "sha512-LOxkQ49CdmIqX040bTF7nyHernZXzhVrRyvQtmxZKeNeIFRWvaIg2IJb+9F7oVW/Q0a2GL69hs22rQdkJoSj3w==",
"dev": true,
"dependencies": {
"qface": "^1.2.0",
"ws": "^8.2.1"
},
"peerDependencies": {
"koishi": "^4.0.0-beta.3"
"koishi": "^4.0.0-beta.5"
}
},
"node_modules/@koishijs/plugin-onebot": {
"version": "4.0.0-alpha.8",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-onebot/-/plugin-onebot-4.0.0-alpha.8.tgz",
"integrity": "sha512-FTVzfbwu2k9pzLtAO5Qu5jME+Lgig3iEkpvcKvd39F2ShgPoD7c33wQInAFcBku19gDG2QM9wSq/Na1eLlFCzA==",
"dev": true,
"dependencies": {
"qface": "^1.2.0",
"ws": "^8.2.1"
},
"peerDependencies": {
"koishi": "^4.0.0-alpha.9"
}
},
"node_modules/@koishijs/utils": {
......@@ -4503,9 +4517,19 @@
}
},
"@koishijs/plugin-adapter-onebot": {
"version": "4.0.0-beta.3",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.3.tgz",
"integrity": "sha512-6UWO5qBRHk95UxSfHmPkuwQuAWeLL6T9YnIMlvg9d1EzTQHJWv66FkK4EdJ7Yfs0DoLdFodZ67eLCP707oeYNA==",
"version": "4.0.0-beta.4",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.4.tgz",
"integrity": "sha512-LOxkQ49CdmIqX040bTF7nyHernZXzhVrRyvQtmxZKeNeIFRWvaIg2IJb+9F7oVW/Q0a2GL69hs22rQdkJoSj3w==",
"dev": true,
"requires": {
"qface": "^1.2.0",
"ws": "^8.2.1"
}
},
"@koishijs/plugin-onebot": {
"version": "4.0.0-alpha.8",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-onebot/-/plugin-onebot-4.0.0-alpha.8.tgz",
"integrity": "sha512-FTVzfbwu2k9pzLtAO5Qu5jME+Lgig3iEkpvcKvd39F2ShgPoD7c33wQInAFcBku19gDG2QM9wSq/Na1eLlFCzA==",
"dev": true,
"requires": {
"qface": "^1.2.0",
......
......@@ -4,6 +4,7 @@ import type { OneBotBot } from '@koishijs/plugin-adapter-onebot/lib/bot';
export interface PluginConfig {
commmandName?: string;
leaveMessage: string;
}
export class MyPlugin {
......@@ -14,6 +15,9 @@ export class MyPlugin {
commmandName: Schema.string()
.description('退群命令名称')
.default('dispose'),
leaveMessage: Schema.string()
.description('确认退群消息')
.default('确定要请我退群吗?输入 yes 以退群。'),
});
private async onQuit(session: Session) {
this.ctx
......@@ -33,6 +37,11 @@ export class MyPlugin {
) {
return;
}
await session.send(this.config.leaveMessage);
const result = await session.prompt();
if (result !== 'yes') {
return;
}
try {
await bot.internal.setGroupLeave(session.guildId, false);
} catch (e) {
......
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