aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-01-03 11:21:13 -0800
committerGravatar MarkKoz <[email protected]>2021-01-04 23:19:55 -0800
commit0d330d7470a97660e91280979d064983f7716ecf (patch)
treea8836312da211c37fb8261e7341aa3272f9a3092
parentHelpChannels: await init task at the start of event listeners (diff)
HelpChannels: prevent user from claiming multiple channels quickly
It's conceivable for a user to be able to quickly send a message in all available channels before the code has a chance to add the cooldown role. Place a lock on the author to prevent the claim code from running multiple times for the same user.
-rw-r--r--bot/exts/help_channels/_cog.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index a9ca01cdd..5695d0d05 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -89,6 +89,7 @@ class HelpChannels(commands.Cog):
self.scheduler.cancel_all()
@lock.lock_arg(NAMESPACE, "message", attrgetter("channel.id"))
+ @lock.lock_arg(NAMESPACE, "message", attrgetter("author.id"))
async def claim_channel(self, message: discord.Message) -> None:
"""
Claim the channel in which the question `message` was sent.