Admin commands
Ballsdex comes with commands to help moderators and administrators manage the bot.
Using admin commands
These commands are hybrid, meaning they can both be used as a slash command (/admin) in
a selection of servers, and as a text command (b.admin) that can be used anywhere.
Note
You can change the b. prefix in your global bot settings.
You're also able to mention the bot to replace the prefix, which is useful if you have message
content intent turned off: @YourBot ping
By default, only bot owners have access to the admin commands.
Slash commands
To synchronize admin slash commands, use b.admin syncslash in the server of your choice.
Refresh your Discord client and commands should appear for administrators only by default.
Info
To grant access to /admin to more roles, head to Server Settings -> Integrations ->
/admin and edit the permissions there.
You can then type /admin and see the list of commands unrolling.
Text commands
If you can't use slash commands, for example if you're in a server other than your own and want to spawn countryballs, you can use regular text commands.
With regular text commands, you can use the b.help command to show the available commands.
b.helpwill show all commands available to youb.help adminwill list all subcommands from adminb.help admin historywill show all subcommands of this subcommandb.help admin history userwill show the full description of this command, with arguments
Let's have a look at this command. It has required arguments and optional arguments shown as "flags". They follow a syntax similar to Discord slash commands, with the key and value separated by a colon.
To execute that command on yourself, you'd do b.admin history user @Yourself. If you want to
filter the trade history with a second user, do b.admin history user @Yourself user2:@Someone.
Another example, if you want to spawn a shiny countryball, use b.admin balls spawn special:Shiny.
If you have to use arguments that would normally require an autocomplete converter (like specials
or countryballs), use the full name instead. If there are spaces in your name, just leave them:
b.admin balls spawn countryball:Russian Empire atk_bonus:20
Info
b.admin balls will change to your configured slash command name. The flag countryball: will
also change to your collectible name.
Admin commands permissions
As the bot owner, you will always have full access to your bot. If you choose to move your application to a Discord developer team, then all members of the team will share the same access.
Beyond that, permissions are handled with Django. You can create users on your admin panel and share them a specific set of permissions, which will then grant them access to some commands.
Creating a Django user
The process is slightly different whether you have enabled "Login with Discord" (OAuth2) or if you're using password-based authentication.
Ask the user to authenticate to the admin panel. They will be denied at first, but the user will be created.
Warning
They will later have access to the admin panel, but only with the permissions you've chosen.
- Open your admin panel and go to the users tab, then add a new user
- Write the username and Discord user ID of your admin
- Disable password-based authentication, unless you want to share them access later
Now you want to tick the "Is staff" checkbox of your user to grant them initial access to the admin panel and the admin commands.
Warning
If you want to remove an admin, do not delete the user object, instead untick the "Active" box. This will disable their account while preserving history.
Granting permissions
Now you can edit your user and grant them individual permissions.
Each model of the bot has a set of 4 permissions: view, add, change, delete. These permissions will be reflected on the admin panel and in the admin commands.
For example, to grant the permission to view the rarity list, you need "Can view countryball". Spawning a countryball requires "Can add countryball instance". Viewing trades requires both "Can view trade" and "Can view trade object".
To make things easier, you can also use permission groups. Give a set of permissions to a group object, then grant these groups to users. For your convenience, two groups are pre-created: "Administrator" and "Staff".
Tip
If you were using Ballsdex v2, these groups will mostly reflect the permissions granted by
root-role-ids and admin-role-ids respectively.
Default groups and permissions
| Permission | Staff | Admin | |
|---|---|---|---|
| Ball | View | ❌ | ✅ |
| Change | ❌ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| Regime | View | ❌ | ✅ |
| Change | ❌ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| Economy | View | ❌ | ✅ |
| Change | ❌ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| Special | View | ❌ | ✅ |
| Change | ❌ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| BallInstance | View | ✅ | ✅ |
| Change | ❌ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| BlacklistedID | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ✅ | ✅ | |
| Delete | ✅ | ✅ | |
| BlacklistedGuild | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ✅ | ✅ | |
| Delete | ✅ | ✅ | |
| BlacklistHistory | View | ✅ | ✅ |
| Change | ❌ | ❌ | |
| Add | ❌ | ❌ | |
| Delete | ❌ | ❌ | |
| Block | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ✅ | ✅ | |
| Delete | ✅ | ✅ | |
| Friendship | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ✅ | ✅ | |
| Delete | ✅ | ✅ | |
| GuildConfig | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| Player | View | ✅ | ✅ |
| Change | ✅ | ✅ | |
| Add | ❌ | ✅ | |
| Delete | ❌ | ✅ | |
| Trade | View | ✅ | ✅ |
| Change | ❌ | ❌ | |
| Add | ❌ | ❌ | |
| Delete | ❌ | ❌ | |
| TradeObject | View | ✅ | ✅ |
| Change | ❌ | ❌ | |
| Add | ❌ | ❌ | |
| Delete | ❌ | ❌ |
You are free to edit those permissions after they were created.