From 6871ec09ae9f02b05cb9657e0442aef7023739c1 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Thu, 30 Sep 2021 16:29:33 -0700 Subject: [PATCH] [MassUnban] Add typing indicator --- massunban/massunban.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/massunban/massunban.py b/massunban/massunban.py index bd4636b..00f0a9e 100644 --- a/massunban/massunban.py +++ b/massunban/massunban.py @@ -56,21 +56,23 @@ class MassUnban(commands.Cog): try: await self.bot.wait_for("message", check=pred, timeout=15) if pred.result is True: - for ban_entry in banlist: - await ctx.guild.unban(ban_entry.user, reason=f"Mass Unban requested by {str(ctx.author)} ({ctx.author.id})") - await asyncio.sleep(0.5) - unban_count += 1 + async with ctx.typing(): + for ban_entry in banlist: + await ctx.guild.unban(ban_entry.user, reason=f"Mass Unban requested by {str(ctx.author)} ({ctx.author.id})") + await asyncio.sleep(0.5) + unban_count += 1 else: return await ctx.send("Alright, I'm not unbanning everyone.") except asyncio.TimeoutError: return await ctx.send("Response timed out. Please run this command again if you wish to try again.") else: - for ban_entry in banlist: - if not ban_entry.reason: - continue - if ban_reason.lower() in ban_entry.reason.lower(): - await ctx.guild.unban(ban_entry.user, reason=f"Mass Unban requested by {str(ctx.author)} ({ctx.author.id})") - await asyncio.sleep(0.5) - unban_count += 1 + async with ctx.typing(): + for ban_entry in banlist: + if not ban_entry.reason: + continue + if ban_reason.lower() in ban_entry.reason.lower(): + await ctx.guild.unban(ban_entry.user, reason=f"Mass Unban requested by {str(ctx.author)} ({ctx.author.id})") + await asyncio.sleep(0.5) + unban_count += 1 await ctx.send(f"Done. Unbanned {unban_count} users.")