1 |
--- |
2 |
title: Permission System |
3 |
short_name: Permission System |
4 |
--- |
5 |
|
6 |
import Callout from "@/components/Alerts/Callout"; |
7 |
|
8 |
# Permission System |
9 |
|
10 |
## Introduction |
11 |
|
12 |
SudoBot supports three different types of permission system: |
13 |
|
14 |
- Discord-based  |
15 |
- Level-based |
16 |
- Permission Roles/Overwrites |
17 |
|
18 |
This is why we say the bot supports "Hybrid Permission System". Whenever we say "Hybrid" we refer to these three possible permission systems. |
19 |
|
20 |
## Discord-based Permission System |
21 |
|
22 |
This is the simplest permission system. When this permission system is enabled on a particular server, the bot will only rely on Discord's permissions. For instance, if someone runs the `ban` command, the bot will check to see if the user has `BanMembers` permission. A member can have this permission if they are the owner/administrator of that server, or if they have a role that explicitly allows the `BanMembers` permission. **This is enabled by default, however it can be customized.** |
23 |
|
24 |
## Level-based Permission System |
25 |
|
26 |
In this system, there are permission levels represented by integers, from 0 to 100. Level 0 obviously means no special permission, and 100 means all possible permissions. You can associate users/roles with a particular permission level to allow them to use certain commands or perform certain actions using the bot. The permission levels have predefined set of permissions, however it can be customized/overwritten by adding entries to the `permission_levels` table inside of the bot's database. |
27 |
|
28 |
<Callout type="warning"> |
29 |
Do not add multiple entries with the same level or entries having a value |
30 |
outside of the 0-100 range in the level column. Otherwise the behavior will |
31 |
be undefined. |
32 |
</Callout> |
33 |
|
34 |
## Permission Roles/Overwrites |
35 |
|
36 |
This is the most advanced permission system. In this system, you create entries in the `permission_roles` table that describe who will get what permissions, having what role and things like that. This is also merged with Discord's permissions when checking. It makes the entire thing extremely customizable. This system might be suitable if you have a really complex permission structure in your server. Each permission role can have a name, and this does not affect the behavior of the bot. |
37 |
|
38 |
## How to Configure The Permission System? |
39 |
|
40 |
To change the permission system or mode, you'll have to edit `config/config.json`. Each server may have a different permission mode.  |
41 |
|
42 |
Change the `permissions.mode` (`mode` property inside the `permissions` object) configuration property to one of the following: |
43 |
|
44 |
- `discord`: Discord-based permission mode (Default) |
45 |
- `levels`: Level-based permission mode |
46 |
- `advanced`: Permission Role/Overwrites |
47 |
|
48 |
And then restart the bot for the changes to take effect. |