allow disabling plugins even if they're not installed anymore

This commit is contained in:
Evert Prants 2021-10-02 20:30:13 +03:00
parent 82f65b6fee
commit 080c995438
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
1 changed files with 2 additions and 6 deletions

View File

@ -185,16 +185,12 @@ export class SqueebotCLI {
}),
cmd('disable', async (...args: string[]): Promise<void> => {
for (const name of args) {
if (!this.bot.pluginManager.getAvailableByName(name)) {
throw new Error(`No such plugin "${name}" found.`);
}
logger.log('Disabling plugin', name);
if (!this.bot.config.config.enabled) {
return;
}
logger.log('Disabling plugin', name);
const indx = this.bot.config.config.enabled.indexOf(name);
if (indx > -1) {
this.bot.config.config.enabled.splice(indx, 1);