@commands.command(description = "Lets moderators mass ban members.", usage = "massban [delete members message days] [reason] [members]") @commands.bot_has_permissions(ban_members = True) @commands.has_permissions(ban_members = True) async def massban2(self, ctx, targets: commands.Greedy[discord.Member]): with ctx.channel.typing(): def check(reaction, user): return user == ctx.author and str(reaction.emoji) in {"❎", "✅"} confirmation = await ctx.reply(f"You are about to ban {len(targets)} members. Do you want to add a reason for this ban? If **yes** react with ✅ and if **no** react with ❎") await confirmation.add_reaction("✅") await confirmation.add_reaction("❎") try: reaction, user = await self.bot.wait_for('reaction_add', timeout = 60.0, check = check) if str(reaction.emoji) == "✅": reason_event = await self.bot.wait_for('message') reason = reason_event.content else: reason = "Unspecified" except asyncio.TimeoutError: confirmation.edit(content = "The time to add a reaction timed out so the defualt reason of `Unspecified` will be used.") reason = "Unspecified" confirmation.edit(content = f"You are about to ban {len(targets)} members. Do you want to select how mnay days of the members messages get deleted? If **yes** react with ✅ and if **no** react with ❎") try: reaction, user = await self.bot.wait_for('reaction_add', timeout = 60.0, check = check) if str(reaction.emoji) == "✅": days_event = await self.bot.wait_for('message') delete_days = days_event.content else: reason = "Unspecified" except asyncio.TimeoutError: confirmation.edit(content = "The time to add a reaction timed out so the defualt of `1` will be used.") delete_days = 1 for user in targets: await user.ban(reason = reason, delete_message_days = delete_days) await confirmation.edit(content = f"{len(targets)} members were just banned with reason {reason}.") await confirmation.clear_reactions()