Chore: Fix the cleanup of Verification channel - #176
Conversation
…s from a moderator
Xarlos89
left a comment
There was a problem hiding this comment.
Looks mostly good, but a few small things that would prevent merging. Nice PR.
| # await sleep(8) | ||
| # bot_message.delete() # remove the message to correct people after 8? seconds | ||
| @commands.Cog.listener() | ||
| async def on_message(self, message): |
There was a problem hiding this comment.
We never actually handle a direct Message, which means the first if gate on line 89 will exit with an attribute error. In a DM, the message.author is a discord.User, which has no .guild.
Additionally, message.author.bot is checked only on 96, so this will probably not send out the DM in the first place
| else: | ||
| await ctx.send("You are already verified. Go away.") | ||
| msg = await ctx.send("You are already verified. Go away.") | ||
| sleep(10) |
There was a problem hiding this comment.
sleep here blocks the event loop, which means another user cannot use the >verify command. We should instead use asyncio.sleep(), so it doesn't do that. I feel like I also remember a delete_after=10.0 argument in ctx.send(), but double check that.
| ) | ||
| sleep(3) | ||
| await response.resource.delete() | ||
| await interaction.user.kick(reason="User admitted to being a robot.") |
There was a problem hiding this comment.
if the resource.delete fails for any reason, the kick might not happen. Could we wrap this in a try-excepty to handle this more gracefully?
Description of your PR
Fixes the already written code for the cleanup of verification channel
Describe your changes
Added
None
Fixed
Verification channel cleanup
Changed
Skipping logging deleted messages from the verification process in the
LoggingMessageDeleteCogRemoved
None
Issue link
Closes #156
Checklist
pre-commitover your PR?master?master?