aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/bot.py
diff options
context:
space:
mode:
authorGravatar Vivaan Verma <[email protected]>2021-08-17 23:26:51 +0100
committerGravatar Vivaan Verma <[email protected]>2021-08-17 23:26:51 +0100
commit2c0224c2b11c6c34664aea8c623f29ca7a3af2fd (patch)
treed61b6bcc0c831d9807390bea5d420e6f1352126e /arthur/bot.py
parentfeat: Make purge zones command use dropdown to choose zone to purge (diff)
feat: Allow for selection of multiple zones
Diffstat (limited to 'arthur/bot.py')
-rw-r--r--arthur/bot.py8
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