Skip to content

Commit

Permalink
If allow list is empty, grab is enabled everywhere (#616)
Browse files Browse the repository at this point in the history
If the allowed_channels grab config item is empty, every channel will have grabs enabed
  • Loading branch information
ajax146 authored Aug 30, 2023
1 parent 4c59e00 commit b5fa1c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions techsupport_bot/extensions/grab.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ async def invalid_channel(ctx):
This is expected to be used in a @commands.check call
"""
config = await ctx.bot.get_context_config(ctx)
# Check if list is empty. If it is, allow all channels
if not config.extensions.grab.allowed_channels.value:
return True
# If this list is not empty, it is a strict whitelist
if str(ctx.channel.id) in config.extensions.grab.allowed_channels.value:
return True
raise commands.CommandError("Grabs are disabled for this channel")
Expand Down

0 comments on commit b5fa1c7

Please sign in to comment.