diff options
| author | 2023-04-27 22:28:08 +0100 | |
|---|---|---|
| committer | 2023-04-27 22:28:08 +0100 | |
| commit | fffe818885154fcc54b399f13155ee95a1a408bc (patch) | |
| tree | 86ead71bb3b5d57f886b77a45455d43bfa2cd5ec /arthur/bot.py | |
| parent | build(deps): bump pydantic from 1.10.5 to 1.10.7 (#50) (diff) | |
| parent | Fix linting errors from new ruff rules (diff) | |
Merge pull request #54 from python-discord/migrate-to-ruff
Migrate to ruff
Diffstat (limited to 'arthur/bot.py')
| -rw-r--r-- | arthur/bot.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arthur/bot.py b/arthur/bot.py index 33aecf5..fc97846 100644 --- a/arthur/bot.py +++ b/arthur/bot.py @@ -1,6 +1,6 @@ """Module containing the core bot base for King Arthur.""" from pathlib import Path -from typing import Any, Union +from typing import Any from discord import Interaction, Member, User from discord.ext import commands @@ -20,13 +20,12 @@ class KingArthur(BotBase): self.add_check(self._is_devops) @staticmethod - def _is_devops(ctx: Union[commands.Context, Interaction]) -> bool: + def _is_devops(ctx: commands.Context | Interaction) -> bool: """Check all commands are executed by authorised personnel.""" if isinstance(ctx, Interaction): if isinstance(ctx.user, Member): return CONFIG.devops_role in [r.id for r in ctx.user.roles] - else: - return False + return False if ctx.command.name == "ed": return True @@ -53,7 +52,7 @@ class KingArthur(BotBase): await self.load_extension("jishaku") logger.info("Loaded <red>jishaku</red>") - async def is_owner(self, user: Union[User, Member]) -> bool: + async def is_owner(self, user: User | Member) -> bool: """Check if the invoker is a bot owner.""" if not user.guild: return False |