Multiple command handler for typescript.
By: Cheree
- Have support to slash commands.
- Works with discord.js V13.
- Typescript version.
- Has updated documentation for all types of users.
- Multillang.
This is the name of the command, all answers of messages with <prefix><name of command>
returns the code of this, is recommended to are only a one word, this is a String
name: String
name: "ping"
The description of the command, this returns the description of the command, is util to help command. This a String
description: String
description: "Ping command"
The aliases for the command, if the command name not found, search in aliases of the command to return that answer. This a Array
aliases?: String[]
aliases?: ["pong", "status"]
The category of the command, if dont have category, is changed with bot
. This a String
category?: String
category?: "bot"
Defines if the command, are disponible to everyone or the owners defined in src/config.ts
. This a Boolean
.
dev?: Boolean
dev?: false
Defines if the command, can be executed in only nsfw channels of no. This a Boolean
.
nsfw?: Boolean
nsfw?: false
The cooldown of the command, if the user is not a developer returns a message with the cooldown of the mentioned seconds, this a Number
cooldown?: Number
cooldown?: 10
The bot detects if have one or the permissions of the Array
can be executed, if i dont have one of the permissions, return a message saying that the bot has not have permissions.
botPermissions?: PermissionString[]
botPermissions?: ["SEND_MESSAGES", "MANAGE_MESSAGES"]
The bot detects if the user that execute the command have one or the permissions of the Array
can be executed, if user dont have one of the permissions, return a message saying that the bot has not have permissions.
botPermissions?: PermissionString[]
botPermissions?: ["MANAGE_GUILD"]
The usage of the command, the excellent Method
for documentation.
usage?(prefix: String): String
usage("!")ping
The example of the command, the excellent Method
for documentation.
usage?(prefix: String): String
usage("!")ping
import { TempContext } from "../../Util/Classes/Context";
import { BaseCommand } from "../../Util/Classes/BaseCommand";
import { Client } from "discord.js";
import { MessageEmbed } from "discord.js";
export default class PingCommand extends BaseCommand {
constructor(client: Client) {
super(client, {
name: `ping`,
description: `Test the bot`,
guildOnly: false,
dev: true,
usage: (prefix: "!")ping,
example: (prefix: "!")ping
});
}
async run(base: TempContext) {
base.channel.send(`pong!`)
}
}