1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00

Finalized hide-warn command

This commit is contained in:
Ean Milligan (Bastion)
2022-05-09 19:18:49 -04:00
parent 88faa27278
commit eba7e028b2
4 changed files with 22 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ export const allowBlock = async (message: DiscordenoMessage, apiArg: string) =>
}
// We won't get here if there's any errors, so we know it has bee successful, so report as such
message.send(generateApiSuccess(apiArg)).catch(e => {
message.send(generateApiSuccess(`${apiArg}ed`)).catch(e => {
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
};

View File

@@ -11,7 +11,7 @@ import { generateApiFailed, generateApiSuccess } from "../../constantCmds.ts";
export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) => {
const guildQuery = await dbClient.query(`SELECT guildid, channelid FROM allowed_guilds WHERE guildid = ? AND channelid = ?`, [message.guildId, message.channelId]).catch(e0 => {
log(LT.ERROR, `Failed to query DB: ${JSON.stringify(e0)}`);
message.send(generateApiFailed(apiArg)).catch(e1 => {
message.send(generateApiFailed(`${apiArg} on`)).catch(e1 => {
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
@@ -21,7 +21,7 @@ export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) =
// Since guild is not in our DB, add it in
await dbClient.execute(`INSERT INTO allowed_guilds(guildid,channelid,hidewarn) values(?,?,?)`, [message.guildId, message.channelId, ((apiArg === "hide-warn") ? 1 : 0)]).catch(e0 => {
log(LT.ERROR, `Failed to insert into DB: ${JSON.stringify(e0)}`);
message.send(generateApiFailed(apiArg)).catch(e1 => {
message.send(generateApiFailed(`${apiArg} on`)).catch(e1 => {
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
@@ -30,7 +30,7 @@ export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) =
// Since guild is in our DB, update it
await dbClient.execute(`UPDATE allowed_guilds SET hidewarn = ? WHERE guildid = ? AND channelid = ?`, [((apiArg === "hide-warn") ? 1 : 0), message.guildId, message.channelId]).catch(e0 => {
log(LT.ERROR, `Failed to update DB: ${JSON.stringify(e0)}`);
message.send(generateApiFailed(apiArg)).catch(e1 => {
message.send(generateApiFailed(`${apiArg} on`)).catch(e1 => {
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;