From bb433749f8a06869d98df344e1c318edef5b9600 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 28 Nov 2021 14:25:00 +0000 Subject: [PATCH] Migrate about command --- commands/about.js | 45 ------------------------------------------- src/commands/about.ts | 22 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 45 deletions(-) delete mode 100644 commands/about.js create mode 100644 src/commands/about.ts diff --git a/commands/about.js b/commands/about.js deleted file mode 100644 index 5c2fbb2..0000000 --- a/commands/about.js +++ /dev/null @@ -1,45 +0,0 @@ -// Required components -const { command } = require('vylbot-core'); -const { MessageEmbed } = require('discord.js'); - -const embedColor = "0x3050ba"; - -// Command Class -class about extends command { - constructor() { - // Set execute method, description, and category - super("about"); - super.description = "About the bot"; - super.category = "General"; - - // Set required configs in the config.about json string. - // description: The bot description - // version: The bot version - // author: Bot author - // date: Date of build - super.requiredConfigs = "description"; - super.requiredConfigs = "version"; - super.requiredConfigs = "core-ver"; - super.requiredConfigs = "author"; - super.requiredConfigs = "date"; - } - - // The execution method - about(context) { - // Create an embed containing data about the bot - const embed = new MessageEmbed() - .setTitle("About") - .setColor(embedColor) - .setDescription(context.client.config.about.description) - .addField("Version", context.client.config.about.version, true) - .addField("VylBot Core", context.client.config.about['core-ver'], true) - .addField("Author", context.client.config.about.author) - .addField("Date", context.client.config.about.date); - - // Send embed to the channel the command was sent in - context.message.channel.send(embed); - } -} - -// Set the about class to be exported -module.exports = about; diff --git a/src/commands/about.ts b/src/commands/about.ts new file mode 100644 index 0000000..f6b30e3 --- /dev/null +++ b/src/commands/about.ts @@ -0,0 +1,22 @@ +import { Command, ICommandContext } from "vylbot-core"; +import { MessageEmbed } from "discord.js"; + +export default class About extends Command { + constructor() { + super(); + super._category = "General"; + } + + public override execute(context: ICommandContext) { + const embed = new MessageEmbed() + .setTitle("About") + .setColor(process.env.EMBED_COLOUR!) + .setDescription("About the bot") + .addField("Version", process.env.BOT_VER) + .addField("VylBot Core", process.env.CORE_VER) + .addField("Author", process.env.BOT_AUTHOR) + .addField("Date", process.env.BOT_DATE); + + context.message.channel.send(embed); + } +} \ No newline at end of file