From 2c0224c2b11c6c34664aea8c623f29ca7a3af2fd Mon Sep 17 00:00:00 2001 From: Vivaan Verma Date: Tue, 17 Aug 2021 23:26:51 +0100 Subject: feat: Allow for selection of multiple zones --- arthur/bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'arthur/bot.py') 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 -- cgit v1.2.3