Migrate about command

This commit is contained in:
Ethan Lane 2021-11-28 14:25:00 +00:00
parent c7417cf7a5
commit bb433749f8
Signed by: Vylpes
GPG key ID: EED233CC06D12504
2 changed files with 22 additions and 45 deletions

View file

@ -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;

22
src/commands/about.ts Normal file
View file

@ -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);
}
}