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

Added @mention command to learn about the bot

This commit is contained in:
Ean Milligan (Bastion)
2022-05-13 18:57:45 -04:00
parent 72b715b188
commit 5b27abbba9
5 changed files with 45 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import { stats } from "./stats.ts";
import { api } from "./apiCmd.ts";
import { emoji } from "./emoji.ts";
import { roll } from "./roll.ts";
import { handleMentions } from "./handleMentions.ts";
export default {
ping,
@@ -23,5 +24,6 @@ export default {
stats,
api,
emoji,
roll
roll,
handleMentions
};

View File

@@ -0,0 +1,22 @@
import { dbClient } from "../db.ts";
import {
// Discordeno deps
DiscordenoMessage,
// Log4Deno deps
LT, log
} from "../../deps.ts";
import { constantCmds } from "../constantCmds.ts";
export const handleMentions = (message: DiscordenoMessage) => {
log(LT.LOG, `Handling @mention message: ${JSON.stringify(message)}`);
// Light telemetry to see how many times a command is being run
dbClient.execute(`CALL INC_CNT("mention");`).catch(e => {
log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(constantCmds.mention).catch(e => {
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
};