mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
refactor: update command and event handling, improve logging, and enhance argument validation, add client inheritance
This commit is contained in:
@@ -73,11 +73,32 @@ const client = new Unicord({
|
||||
console.log(`Logged in as ${payload.user.username}`);
|
||||
});
|
||||
|
||||
client.login(DISCORD_CLIENT_TOKEN);
|
||||
// client.login(DISCORD_CLIENT_TOKEN);
|
||||
|
||||
// Allow use of "child" instances inside parent instance
|
||||
// const client2 = new Unicord().chatCommand('ping', async (context, _) => {
|
||||
// await context.reply('Pong!');
|
||||
// });
|
||||
const etc = new Unicord().registerChatCommand(
|
||||
'zing',
|
||||
async (context, args) => {
|
||||
await context.reply(`Zing! You got served!` + args.fav_amimal ? ` One ${args.fav_amimal} please!` : '');
|
||||
},
|
||||
{
|
||||
args: [
|
||||
{
|
||||
name: 'fav_amimal',
|
||||
description: 'Your favorite animal',
|
||||
type: UnicordArgumentType.String,
|
||||
required: false,
|
||||
choices: [
|
||||
{ name: 'Dog', value: 'dog' },
|
||||
{ name: 'Cat', value: 'cat' },
|
||||
{ name: 'Hamster', value: 'hamster' },
|
||||
{ name: 'Dolphin', value: 'dolphin' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
// new Unicord().use(client2).login(DISCORD_CLIENT_TOKEN);
|
||||
client.use(etc);
|
||||
|
||||
client.login();
|
||||
Reference in New Issue
Block a user