This is the basic structure of a command.
const Discord = require("discord.js");
module.exports = {
name: "ping",
aliases: ["pong"],
execute({ bot, message, args, hkandler }) {
let pingEmbed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle("Pong!")
.setDescription(`API Latency: ${bot.ws.ping}ms!`);
message.channel.send(pingEmbed);
},
};
import { Client, Message } from "discord.js"
import { HKandler } from "hkutilities/dist/structures/hkandler"
export = {
name: "ping",
execute({ bot, message, args, hkandler }: {bot: Client, message: Message, args: string[], hkandler: HKandler}) {
let pingEmbed = new MessageEmbed()
.setColor("RANDOM")
.setTitle("Pong!")
.setDescription(`API Latency: ${bot.ws.ping}ms!`);
message.channel.send(pingEmbed);
},
}
With the default message event, the following properties can be used:
Aliases => other names that the command can be called with
clientPerms => the permission(s) that the bot will need when running a command
userPerms => the permission(s) that the user will need when running a command
minArgs => the minimum amount of arguments
maxArgs => the maximum amount of arguments
ownerOnly => set it so only bot owners can use the command
cooldown => number of seconds between each command use per user