Feature/23 migrate to typescript #73
|
@ -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
|
@ -0,0 +1,22 @@
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
import { Command, ICommandContext } from "vylbot-core";
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
import { MessageEmbed } from "discord.js";
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
export default class About extends Command {
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
constructor() {
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
super();
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
super._category = "General";
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
}
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
public override execute(context: ICommandContext) {
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
const embed = new MessageEmbed()
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.setTitle("About")
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.setColor(process.env.EMBED_COLOUR!)
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.setDescription("About the bot")
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.addField("Version", process.env.BOT_VER)
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.addField("VylBot Core", process.env.CORE_VER)
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.addField("Author", process.env.BOT_AUTHOR)
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
.addField("Date", process.env.BOT_DATE);
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
context.message.channel.send(embed);
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
}
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
|||||||
|
}
|
||||||
This should use the This should use the `PublicEmbed` class you made
|
This should use the
PublicEmbed
class you made