diff options
author | 2023-03-30 12:15:56 +0300 | |
---|---|---|
committer | 2023-03-30 12:15:56 +0300 | |
commit | 30caf003204c4513a221ceb5fd58cef9747efd8f (patch) | |
tree | 41ca863864337c1ebc77e8517aeb406b501a0e21 /bot | |
parent | Ensure page is always random (diff) | |
parent | Update base image to new repo org (#1241) (diff) |
Merge branch 'main' into fix-1121
Diffstat (limited to 'bot')
-rw-r--r-- | bot/constants.py | 1 | ||||
-rw-r--r-- | bot/exts/fun/latex.py | 1 | ||||
-rw-r--r-- | bot/exts/fun/snakes/_snakes_cog.py | 8 | ||||
-rw-r--r-- | bot/utils/checks.py | 10 |
4 files changed, 13 insertions, 7 deletions
diff --git a/bot/constants.py b/bot/constants.py index fed41ab9..7e5fa1d9 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -57,6 +57,7 @@ class Channels(NamedTuple): off_topic_0 = 291284109232308226 off_topic_1 = 463035241142026251 off_topic_2 = 463035268514185226 + python_help = 1035199133436354600 sir_lancebot_playground = int(environ.get("CHANNEL_COMMUNITY_BOT_COMMANDS", 607247579608121354)) voice_chat_0 = 412357430186344448 voice_chat_1 = 799647045886541885 diff --git a/bot/exts/fun/latex.py b/bot/exts/fun/latex.py index 311b4ac2..8af05413 100644 --- a/bot/exts/fun/latex.py +++ b/bot/exts/fun/latex.py @@ -37,6 +37,7 @@ PAD = 10 LATEX_ALLOWED_CHANNNELS = WHITELISTED_CHANNELS + ( Channels.data_science_and_ai, Channels.algos_and_data_structs, + Channels.python_help, ) diff --git a/bot/exts/fun/snakes/_snakes_cog.py b/bot/exts/fun/snakes/_snakes_cog.py index 96718200..d0542c23 100644 --- a/bot/exts/fun/snakes/_snakes_cog.py +++ b/bot/exts/fun/snakes/_snakes_cog.py @@ -598,7 +598,7 @@ class Snakes(Cog): Written by Momo and kel. Modified by juan and lemon. """ - with ctx.typing(): + async with ctx.typing(): # Generate random snake attributes width = random.randint(6, 10) @@ -637,7 +637,7 @@ class Snakes(Cog): Created by Ava and eivl. """ - with ctx.typing(): + async with ctx.typing(): if name is None: name = await Snake.random() @@ -693,7 +693,7 @@ class Snakes(Cog): Made by Ava and eivl. Modified by lemon. """ - with ctx.typing(): + async with ctx.typing(): image = None @@ -1047,7 +1047,7 @@ class Snakes(Cog): Written by Momo and kel. Modified by lemon. """ - with ctx.typing(): + async with ctx.typing(): embed = Embed() user = ctx.author diff --git a/bot/utils/checks.py b/bot/utils/checks.py index 5433f436..857b6746 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -60,16 +60,20 @@ def in_whitelist_check( # categories, it's probably not wise to rely on its category in any case. channels = tuple(channels) + (redirect,) - if channels and ctx.channel.id in channels: + ctx_channel = ctx.channel + if hasattr(ctx_channel, "parent"): + ctx_channel = ctx_channel.parent + + if channels and ctx_channel.id in channels: log.trace(f"{ctx.author} may use the `{ctx.command.name}` command as they are in a whitelisted channel.") return True # Only check the category id if we have a category whitelist and the channel has a `category_id` - if categories and hasattr(ctx.channel, "category_id") and ctx.channel.category_id in categories: + if categories and hasattr(ctx_channel, "category_id") and ctx_channel.category_id in categories: log.trace(f"{ctx.author} may use the `{ctx.command.name}` command as they are in a whitelisted category.") return True - category = getattr(ctx.channel, "category", None) + category = getattr(ctx_channel, "category", None) if category and category.name == constants.codejam_categories_name: log.trace(f"{ctx.author} may use the `{ctx.command.name}` command as they are in a codejam team channel.") return True |