aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils
diff options
context:
space:
mode:
authorGravatar Kronifer <[email protected]>2021-08-17 08:45:19 -0500
committerGravatar GitHub <[email protected]>2021-08-17 08:45:19 -0500
commite098273a3ddd3afd8b254aad439b08fc380ff40e (patch)
tree21e57bd813ffd5cc05aee3844cb6b362f10d6a0e /bot/utils
parentRemoved a massive it block (diff)
parentMerge pull request #792 from python-discord/more-py-topics (diff)
Merge branch 'main' into main
Diffstat (limited to 'bot/utils')
-rw-r--r--bot/utils/checks.py5
-rw-r--r--bot/utils/pagination.py6
2 files changed, 8 insertions, 3 deletions
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", ())):
diff --git a/bot/utils/pagination.py b/bot/utils/pagination.py
index d9c0862a..b1062c09 100644
--- a/bot/utils/pagination.py
+++ b/bot/utils/pagination.py
@@ -20,7 +20,7 @@ PAGINATION_EMOJI = (FIRST_EMOJI, LEFT_EMOJI, RIGHT_EMOJI, LAST_EMOJI, DELETE_EMO
log = logging.getLogger(__name__)
-class EmptyPaginatorEmbed(Exception):
+class EmptyPaginatorEmbedError(Exception):
"""Base Exception class for an empty paginator embed."""
@@ -141,7 +141,7 @@ class LinePaginator(Paginator):
if not lines:
if exception_on_empty_embed:
log.exception("Pagination asked for empty lines iterable")
- raise EmptyPaginatorEmbed("No lines to paginate")
+ raise EmptyPaginatorEmbedError("No lines to paginate")
log.debug("No lines to add to paginator, adding '(nothing to display)' message")
lines.append("(nothing to display)")
@@ -349,7 +349,7 @@ class ImagePaginator(Paginator):
if not pages:
if exception_on_empty_embed:
log.exception("Pagination asked for empty image list")
- raise EmptyPaginatorEmbed("No images to paginate")
+ raise EmptyPaginatorEmbedError("No images to paginate")
log.debug("No images to add to paginator, adding '(no images to display)' message")
pages.append(("(no images to display)", ""))