Delete guild from DB when bot is removed from said guild
This commit is contained in:
parent
c0ba9b7080
commit
7cf62d44aa
4
mod.ts
4
mod.ts
|
@ -24,6 +24,7 @@ import {
|
||||||
startBot,
|
startBot,
|
||||||
} from './deps.ts';
|
} from './deps.ts';
|
||||||
import api from './src/api.ts';
|
import api from './src/api.ts';
|
||||||
|
import { dbClient } from './src/db.ts';
|
||||||
import commands from './src/commands/_index.ts';
|
import commands from './src/commands/_index.ts';
|
||||||
import intervals from './src/intervals.ts';
|
import intervals from './src/intervals.ts';
|
||||||
import utils from './src/utils.ts';
|
import utils from './src/utils.ts';
|
||||||
|
@ -99,6 +100,9 @@ startBot({
|
||||||
sendMessage(config.logChannel, `I have been removed from: ${guild.name} (id: ${guild.id}).`).catch((e) => {
|
sendMessage(config.logChannel, `I have been removed from: ${guild.name} (id: ${guild.id}).`).catch((e) => {
|
||||||
log(LT.ERROR, `Failed to send message: ${JSON.stringify(e)}`);
|
log(LT.ERROR, `Failed to send message: ${JSON.stringify(e)}`);
|
||||||
});
|
});
|
||||||
|
dbClient.execute('DELETE FROM allowed_guilds WHERE guildid = ? AND banned = 0', [guild.id]).catch((e) => {
|
||||||
|
log(LT.ERROR, `Failed to DELETE guild from DB: ${JSON.stringify(e)}`);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
debug: DEVMODE ? (dmsg) => log(LT.LOG, `Debug Message | ${JSON.stringify(dmsg)}`) : undefined,
|
debug: DEVMODE ? (dmsg) => log(LT.LOG, `Debug Message | ${JSON.stringify(dmsg)}`) : undefined,
|
||||||
messageCreate: (message: DiscordenoMessage) => {
|
messageCreate: (message: DiscordenoMessage) => {
|
||||||
|
|
Loading…
Reference in New Issue