aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/cheatsheet.py
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-02-02 06:16:38 +0530
committerGravatar Shivansh-007 <[email protected]>2021-02-02 06:16:38 +0530
commitb10b2524a1284f7462f3b0f039827e6d115e7931 (patch)
treeb4067028861351eb5ff1578242501dbe7c74df3c /bot/exts/evergreen/cheatsheet.py
parentAllow cht.sh command to be used in occupied help channels (diff)
Improve category check code
Diffstat (limited to 'bot/exts/evergreen/cheatsheet.py')
-rw-r--r--bot/exts/evergreen/cheatsheet.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/exts/evergreen/cheatsheet.py b/bot/exts/evergreen/cheatsheet.py
index 83098c76..abc5306b 100644
--- a/bot/exts/evergreen/cheatsheet.py
+++ b/bot/exts/evergreen/cheatsheet.py
@@ -3,7 +3,7 @@ import re
import typing as t
from urllib.parse import quote_plus
-from discord import Embed, utils
+from discord import Embed
from discord.ext import commands
from discord.ext.commands import BucketType, Context
@@ -82,9 +82,10 @@ class CheatSheet(commands.Cog):
Usage:
--> .cht read json
"""
- category = utils.get(ctx.message.guild.categories, id=Categories.help_in_use)
- all_allowed_channels = WHITELISTED_CHANNELS + tuple(category.channels)
- if ctx.channel not in all_allowed_channels:
+ if not (
+ ctx.channel.category.id == Categories.help_in_use
+ or ctx.channel.id in WHITELISTED_CHANNELS
+ ):
return
async with self.bot.http_session.get(