diff options
| author | 2021-08-18 00:45:28 +0100 | |
|---|---|---|
| committer | 2021-08-18 00:45:28 +0100 | |
| commit | a7a0b505dfffdb4bfa938538b33784dfcbd85d94 (patch) | |
| tree | cda722ad55789fba3f1f331c64122fe5ccd9e1c8 /arthur/bot.py | |
| parent | Merge branch 'main' of github.com:python-discord/king-arthur (diff) | |
| parent | fix: Make string f-string (diff) | |
Merge pull request #5 from doublevcodes/main
Diffstat (limited to 'arthur/bot.py')
| -rw-r--r-- | arthur/bot.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arthur/bot.py b/arthur/bot.py index 249ada7..ffcb476 100644 --- a/arthur/bot.py +++ b/arthur/bot.py @@ -1,7 +1,8 @@ """Module containing the core bot base for King Arthur.""" from pathlib import Path -from typing import Any +from typing import Any, Union +from discord import Interaction from discord.ext import commands from discord.ext.commands import Bot from kubernetes_asyncio import config @@ -27,8 +28,11 @@ class KingArthur(Bot): self.add_check(self._is_devops) @staticmethod - async def _is_devops(ctx: commands.Context) -> bool: + def _is_devops(ctx: Union[commands.Context, Interaction]) -> bool: """Check all commands are executed by authorised personnel.""" + if isinstance(ctx, Interaction): + return CONFIG.devops_role in [r.id for r in ctx.author.roles] + if ctx.command.name == "ed": return True |