-
Notifications
You must be signed in to change notification settings - Fork 0
wc.command()
- Description: Creates a new prefix command.
- Name
String
: The name of the command - Aliases
Array
: Array of alternate names for the command - Cooldown
String
orNumber
: Cooldown for the command, if number it defaults to seconds. ( 10 == "10s") - Action
Function
: What is done when the command is ran
- ctx
Message
: Context of the command's message - cmd
Command
: Info about the command like name, arguments, cooldown, etc
{
ctx: Message, // message for the command
cmd: {
name: String, // command name
aliases: Array, // command aliases
args: Array, // command arguments
data: Function, // action the command does
cooldown: {
data: Set, // stores the users on cooldown
active: Boolean, // if the cooldown is active
time: Number, // how long the cooldown is
relative: String, // relative unix timestamp
raw: Number, // raw unix timestamp
handle: Function, // handler
fetch: Function // fetcher
},
onCooldown: Boolean, // if the command is on cooldown
cooldownType: String // type of cooldown
}
}
wc.command("name", async (ctx, cmd) => {
// action
})
wc.command( {name: "name"}, async (ctx, cmd) => {
// action
})
wc.command( {name: "name", aliases: ["name2", "name3"]}, async (ctx, cmd) => {
// action
})
wc.command( {name: "name", cooldown: 10}, async (ctx, cmd) => {
// action
})
wc.command( {name: "name", cooldown: "10s"}, async (ctx, cmd) => {
// action
})
!ping command
wc.command("ping", async (ctx) => {
ctx.reply("pong!");
});
!say command
wc.command("say", async (ctx, cmd) => {
console.log(cmd.args[0]); // "arguments"
console.log(cmd.args[1]); // "are"
console.log(cmd.args[cmd.args.length-1]); // "thing!"
ctx.channel.send(cmd.args.join(" ")); // sends "arguments are a thing!"
});
!avatar command
wc.command( {name: "avatar", aliases: ["av"]}, async (ctx, cmd) => {
// if there is no argument it defaults to the message author
let user = await wc.fetchUser(cmd.args[0]);
return ctx.reply(wc.user.avatar(user));
});
!avatar command (with cooldown)
wc.command( {name: "avatar", aliases: ["av"], cooldown: "1s"}, async (ctx, cmd) => {
if (cmd.onCooldown) return wc.reply("Command is on cooldown!", {deleteAfter: "1s"});
// if there is no argument it defaults to the message author
let user = await wc.fetchUser(cmd.args[0]);
return ctx.reply(wc.user.avatar(user));
});
For a look at some examples check out the examples folder
If anything with the mod is updated you can look to the releases for info on it
For a look into the development check out the index.js file
This mod is not associated with the creators of Discord, Discord.JS, or Discord.PY this was created out of love for Discord bot development because I wanted to make things easier for people. I do not condone harassment of the original developers and or anyone else involved in the creation of them.
I am not responsible for anything made with this mod and be sure to follow Discord's terms of service and their community guildlines while developing.
Basics
wc.command()
wc.slashCommand()
wc.commandList
wc.slashCommandList
Basics
wc.event()
wc.eventList
wc.commandAction()
wc.buttonAction()
wc.selectionAction()
wc.rowAction()
wc.fetchMessage()
wc.fetchReply()
wc.fetchUser()
wc.fetchGuildUser()
wc.fetchChannel()
wc.fetchGuildChannel()
wc.fetchRole()
wc.fetchGuildRole()
wc.fetchGuild()
wc.parseEmoji()
wc.parseSticker()