1.0.0
WillClient 1.0.0
Slash Command Update
- Added slash commands with wc.slashCommand()
- Added slash command events
- Added plugins
- Updated command handling
- Updated event action functions to have the option to specify the button's id
- Added custom Function and Property classes
- Added cooldown events
- Rewrote documentation
- Reorganized and updated custom event list
- Reorganized and updated permissions list
- Added setToken()
- Added wc.ctx
- Added fileType parameter for parseEmoji()
- Token is required in the creation of new instances now for registering slash commands
const { Client } = require('discord.js');
const client = new Client({ /* your stuff here */ });
const { WillClient } = require('willclient');
const config = require('./config.json');
const wc = new WillClient({ client: client, prefix: "!", token: config.token });
wc.event("ready", (ctx) => {
console.log(`Logged in as ${ctx.user.tag}`);
});
/* commands */
wc.slashCommand({ name: "ping", desc: "Replies with pong!", cooldown: "5s" }, async (ctx, cmd) => {
if (cmd.onCooldown) return;
ctx.reply("Pong!");
});
wc.slashCommand("button", "Sends a button to press", async (ctx, cmd) => {
let button = new wc.Button({ id: "TestButton", label: "Press me!", style: "primary" });
let row = new wc.ActionRow([ button ]);
ctx.reply({ components: [row] });
});
/* events */
wc.buttonAction("TestButton", (ctx) => {
ctx.reply("You pressed me!");
});
wc.event("onCooldown", (ctx, cmd) => {
ctx.reply("Command on cooldown!");
});
client.login(config.token);