User Roles
Sometimes you want to filter who can use a command.
Think of the KickCommand that kicks a user, it's not good that members can kick moderators, for example.
In this command we will show you how to code the KickCommand.
The KickCommand#
path/to/your/app/src/Commands/KickCommand.ts
info
Notice that in we requiring the user to have one of the roles: admin or moderator by using the oneOf utilitary method from Discapp.
Discapp also provides the allOf method for requiring all of the roles. You can use the allOf and oneOf in permissions, roles, clientPermissions and clientRoles.
Testing the KickCommand#
You can test the the KickCommand by adding another bot to your server and sending:
Now the other bot must have been kicked.
danger
Certify that your bot has higher ranking that the bot you're kicking.