From 0da672ab6b9a38029a2605b30cb65f400c5032e0 Mon Sep 17 00:00:00 2001 From: Thomas Voss <57815710+Mango0x45@users.noreply.github.com> Date: Sun, 12 Jul 2020 01:00:26 +0200 Subject: Update admin.py --- cogs/admin.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cogs/admin.py b/cogs/admin.py index d2b3cab..f0ab204 100755 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -155,6 +155,31 @@ class Admin(commands.Cog): await i.remove_roles(muted_role) await ctx.send("{0.mention} has been unmuted by {1.mention}".format(i, ctx.author)) + @commands.command() + @commands.check(is_botmaster) + async def ban(self, ctx, members: commands.Greedy[discord.Member]=False, + mute_minutes: int = 0, + *, reason: str = "absolutely no reason"): + """Mass mute members with an optional mute_minutes parameter to time it""" + + if not members: + await ctx.send("You need to name someone to ban") + return + elif type(members)==str: + members = [self.bot.get_user(int(members))] + for member in members: + if self.bot.user == member: # what good is a muted bot? + embed = discord.Embed(title = "You can't ban me, I'm an almighty bot") + await ctx.send(embed = embed) + continue + await guild.ban(member, reason="A reason idk") + await ctx.send("{0.mention} has been banned by {1.mention} for *{2}*".format(member, ctx.author, reason)) + + if mute_minutes > 0: + await asyncio.sleep(mute_minutes * 60) + for member in members: + await guild.unban(member, reason="Time is up") + @commands.command() @commands.check(is_botmaster) async def logs(self, ctx): -- cgit v1.2.3