-
Notifications
You must be signed in to change notification settings - Fork 0
wc.slashCommand()
- Description: Creates a new slash command.
- Name
String
: The name of the command (REQUIRED) - Description
String
: A description of the command (REQUIRED) - Cooldown
String
orNumber
: Cooldown for the command, if number it defaults to seconds. ( 10 == "10s" ) - Options
Array
: Options for the command - Action
Function
: What is done when the command is ran - NSFW
Boolean
: If the command is NSFW or not
- ctx
Interaction
: Context of the command's interaction - cmd
Command
: Info about the command like name, arguments, cooldown, etc
{
ctx: Interaction, // interaction for the command
cmd: {
name: String, // command name (required)
description: String, // command description (required)
options: Array, // command options
nsfw: Boolean, // if the command is nsfw or not
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
}
}
- Name
String
: Name of the option - Description
String
: Description of the option - Required
Boolean
: If the option is required or not - Type
String
orNumber
: Type of the option
{
name: String,
description: String,
required: Boolean,
type: String || Number
}
Types | Alternates | Bits |
---|---|---|
sub_command | • sub_com • sub |
1 |
sub_command_group | • sub_com_group • sub_group |
2 |
string | • str | 3 |
integer | • int | 4 |
booelan | • bool | 5 |
user | • member | 6 |
channel | None | 7 |
roles | None | 8 |
mentionable | • mention | 9 |
number | • num | 10 |
attachment | • file | 11 |
wc.slashCommand("name", "description", async (ctx, cmd) => {
// action
})
wc.slashCommand( {name: "name", description: "description"}, async (ctx, cmd) => {
// action
})
wc.slashCommand( {name: "name", desc: "description"}, async (ctx, cmd) => {
// action
})
wc.slashCommand( {name: "name", desc: "description", cooldown: 10}, async (ctx, cmd) => {
// action
})
wc.slashCommand( {name: "name", desc: "description", cooldown: "10s"}, async (ctx, cmd) => {
// action
})
!ping command
wc.slashCommand("ping", "Replies with pong!", async (ctx, cmd) => {
ctx.reply("Pong!");
});
!say command
async function action(ctx, cmd) {
ctx.channel.send(cmd.args[0].value)
wc.reply(`Well said!`, { ephemeral: true })
};
let options = [{
name: "text",
desc: "What it sends",
type: "string",
required: true
}];
wc.slashCommand({ name: "say", desc: "Sends what you enter", options: options}, action);
!avatar command
async function action(ctx, cmd) {
let user = (cmd.args[0]) ? await wc.fetchUser(cmd.args[0].value) : ctx.user
await ctx.reply(wc.user.avatar(user))
};
let options = [
{
name: "user",
description: "user to get",
type: "user"
}
];
wc.slashCommand({ name: "avatar", desc: "Sends a user's avatar", options: options}, action);
!avatar command (with cooldown)
async function action(ctx, cmd) {
if (cmd.onCooldown) return wc.reply("Command is on cooldown!", { ephemeral: true });
let user = (cmd.args[0]) ? await wc.fetchUser(cmd.args[0].value) : ctx.user
await ctx.reply(wc.user.avatar(user))
};
let options = [
{
name: "user",
description: "user to get",
type: "user"
}
];
wc.slashCommand({ name: "avatar", desc: "Sends a user's avatar", options: options, cooldown: "5s"}, action);
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()