diff options
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 |