import { bootstrap, Command, Handler, hasRoles } from "discord-framework";
// Ping command
@Command({
name: 'ping'
})
class PingCommand {
action() { return 'Pong!'; }
}
// Admin specific command
@Command({
name: 'kick',
arguments: [{ key: 'userToKick', type: 'member' }],
canRun: hasRoles(['admin'], 'Whoops you need the admin role')
})
class AdminCommand {
action({ args }) {
args.userToKick.kick();
return `${args.userToKick.name} has been kicked!`;
}
}
@Handler({
name: 'main',
commands: [PingCommand, AdminCommand]
})
class MainHandler { }
bootstrap(MainHandler, {
prefix: '!',
token: '<Discord bot token>'
}).on('ready', () => console.log('Bot is ready'));
-
Notifications
You must be signed in to change notification settings - Fork 0
Expressive typescript framework for building Discord bots
License
DenseOriginal/discord-framework
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Expressive typescript framework for building Discord bots
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published