mirror of
https://github.com/Burn-E99/TheArtificer.git
synced 2026-06-04 00:53:50 -04:00
Added @mention command to learn about the bot
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
22
src/commands/handleMentions.ts
Normal file
22
src/commands/handleMentions.ts
Normal 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)}`);
|
||||
});
|
||||
};
|
||||
@@ -159,6 +159,15 @@ export const constantCmds = {
|
||||
title: "Compiling latest statistics . . ."
|
||||
}]
|
||||
},
|
||||
mention: {
|
||||
embeds: [{
|
||||
title: `Hello! I am ${config.name}!`,
|
||||
fields: [{
|
||||
name: "I am a bot that specializes in rolling dice and doing basic algebra",
|
||||
value: `To learn about my available commands, please run \`${config.prefix}help\``
|
||||
}]
|
||||
}]
|
||||
},
|
||||
privacy: {
|
||||
embeds: [{
|
||||
title: "Privacy Policy",
|
||||
|
||||
Reference in New Issue
Block a user