aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-07-06 18:26:38 +0200
committerGravatar GitHub <[email protected]>2021-07-06 18:26:38 +0200
commit6ff6c97b5f5df0b54da8bc63594fe2fe7fe00bde (patch)
tree9bc649338cb0760093a97ab52da3768582fcf50d
parentMerge pull request #774 from python-discord/new-github-emoji (diff)
parentAllow commands in code jam team channels (diff)
Merge pull request #779 from python-discord/wookie184-codejam-permissions
Allow commands in code jam team channels
-rw-r--r--bot/constants.py1
-rw-r--r--bot/utils/checks.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 7bd10b5f..3b3d7711 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -127,6 +127,7 @@ class Categories(NamedTuple):
media = 799054581991997460
staff = 364918151625965579
+codejam_categories_name = "Code Jam" # Name of the codejam team categories
class Client(NamedTuple):
name = "Sir Lancebot"
diff --git a/bot/utils/checks.py b/bot/utils/checks.py
index c06b6870..438ec750 100644
--- a/bot/utils/checks.py
+++ b/bot/utils/checks.py
@@ -75,6 +75,11 @@ def in_whitelist_check(
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)
+ 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
+
# Only check the roles whitelist if we have one and ensure the author's roles attribute returns
# an iterable to prevent breakage in DM channels (for if we ever decide to enable commands there).
if roles and any(r.id in roles for r in getattr(ctx.author, "roles", ())):