Skip to content

Commit 66c0b79

Browse files
committed
CHANGES:
- Do not restrict_commands for the bot owner by default. You can re-enable that by setting restrict_owner to true in your nodes.yaml
1 parent 13151fb commit 66c0b79

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

MULTINODE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ Node2: # node where I do not have full control
187187
# ...
188188
```
189189
190+
> [!NOTE]
191+
> Unless you specify `restrict_owner: true` in nodes.yaml, the owner of the bot can still run restricted commands.
192+
190193
### Moving a Server from one Node / Instance to another
191194
Each server is loosely coupled to an instance on a node. You can migrate a server to another instance though, by using
192195
the `/server migrate` command.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ NODENAME: # this will usually be your hostname
351351
use_upnp: true # The bot will auto-detect if there is a UPnP IGD available and configure this setting initially for you! If you do NOT want to use UPnP, even IF it is available, put this to false.
352352
nodestats: true # Enable/disable node statistics (database pool and event queue sizes), default: true
353353
restrict_commands: true # Disable commands that can affect the integrity of the server. Default: false (see MULTINODE.md)
354+
restrict_owner: false # If set to true, the owner of the bot can also not run restricted commands. Default: false (see MULTINODE.md)
354355
database: # Optional: It might be that you need to use different IPs to connect to the same database server. This is the place you could do that.
355356
url: postgres://USER:PASSWORD@DB-IP:DB-PORT/DB-NAME # The bot will auto-move the database password from here to a secret place and replace it with SECRET.
356357
pool_min: 5 # min size of the DB pool, default is 5
@@ -500,7 +501,7 @@ This is your Discord-bot configuration.
500501
501502
```yaml
502503
token: SECRET_DISCORD_TOKEN # Your TOKEN, as received from the discord developer portal. The bot will auto-move this to a secret place.
503-
owner: 1122334455667788 # The ID of your bot user. Right-click, select "Copy User ID".
504+
owner: 1122334455667788 # The Discord ID of the owner. Right-click on your Discord user, select "Copy User ID". If unsure, use the bot user.
504505
automatch: true # Use the bot's auto-matching functionality (see below), default is false.
505506
autoban: false # Use the bot's auto-ban functionality (see below), default is false.
506507
autorole: # Automatically give roles to people, depending on conditions (see below). The roles need to be set up in your Discord server.

core/utils/discord.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,11 @@ async def wrapper(interaction: Interaction):
487487

488488

489489
def is_restricted(interaction: discord.Interaction) -> bool:
490-
return interaction.client.node.locals.get('restrict_commands', False)
490+
if interaction.client.node.locals.get('restrict_commands', False):
491+
if not interaction.client.node.locals.get('restrict_owner', False) and interaction.user.id == interaction.client.owner_id:
492+
return False
493+
return True
494+
return False
491495

492496
def restricted_check(interaction: discord.Interaction) -> bool:
493497
return not is_restricted(interaction)

schemas/nodes_schema.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mapping:
1212
slow_system: {type: bool, nullable: false}
1313
nodestats: {type: bool, nullable: false}
1414
restrict_commands: {type: bool, nullable: false}
15+
restrict_owner: {type: bool, nullable: false}
1516
cluster:
1617
type: map
1718
nullable: false

0 commit comments

Comments
 (0)