async def kick(self, ctx, member: discord.Member, *, reason: str = None): """ Kicks a user from the current server. """ try: await member.kick(reason=default.responsible(ctx.author, reason)) loggingchan = self.bot.get_channel(499327315088769025) await ctx.send(default.actionmessage("kicked", member)) await loggingchan.send(default.actionmessage("kicked", member)) except Exception as e: await ctx.send(e)
async def ban(self, ctx, member: discord.member, *, reason: str = None): """ Bans a user from the current server. """ try: await ctx.guild.ban( discord.Object(id=member), reason=default.responsible(ctx.author, reason), ) loggingchan = self.bot.get_channel(499327315088769025) await ctx.send(default.actionmessage("banned", member)) await loggingchan.send(default.actionmessage("banned", member)) except Exception as e: await ctx.send(e)
async def unban(self, ctx, member: MemberID, *, reason: str = None): """ Unbans a user from the current server. """ try: await ctx.guild.unban(discord.Object(id=member), reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("unbanned")) except Exception as e: await ctx.send(e)
async def kick(self, ctx, member: discord.Member, *, reason: str = None): """ Kicks a user from the current server. """ try: await member.kick(reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("kicked")) except Exception as e: await ctx.send(e)
async def unmute(self, ctx, member: discord.Member, *, reason: str = None): """ Mutes a user from the current server. """ message = [] for role in ctx.guild.roles: if role.name == "Muted": message.append(role.id) try: therole = discord.Object(id=message[0]) except IndexError: return await ctx.send("Are you sure you've made a role called **Muted**? Remember that it's case sensetive too...") try: await member.remove_roles(therole, reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("unmuted")) except Exception as e: await ctx.send(e)
async def massban(self, ctx, reason: ActionReason, *members: MemberID): """ Mass bans multiple members from the server. """ try: for member_id in members: await ctx.guild.ban(discord.Object(id=member_id), reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("massbanned", mass=True)) except Exception as e: await ctx.send(e)
async def kick(self, ctx, member: discord.Member, *, reason: str = None): """ Kicks a user from the current server. """ try: if reason == "-f": await member.kick( reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("kicked")) else: role_names = [role.name for role in member.roles] role_names = role_names[1:] for role in role_names: f**k = discord.utils.get(ctx.guild.roles, name=f"{role}") #await ctx.send(f"{f**k}") await member.remove_roles(f**k) await ctx.send(default.actionmessage("kicked")) except Exception as e: await ctx.send(e)
async def ban(self, ctx, member: MemberID, *, reason: str = None): """ Bans a user from the current server. """ m = ctx.guild.get_member(member) if m is not None and await permissions.check_priv(ctx, m): return try: await ctx.guild.ban(discord.Object(id=member), reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("banned")) except Exception as e: await ctx.send(e)
async def unmute(self, ctx, member: discord.Member, *, reason: str = None): """ Unmutes a user from the current server. """ if await permissions.check_priv(ctx, member): return muted_role = next((g for g in ctx.guild.roles if g.name == "Muted"), None) if not muted_role: return await ctx.send("Are you sure you've made a role called **Muted**? Remember that it's case sensetive too...") try: await member.remove_roles(muted_role, reason=default.responsible(ctx.author, reason)) await ctx.send(default.actionmessage("unmuted")) except Exception as e: await ctx.send(e)
async def unban(self, ctx, member: MemberID, *, reason: str = None): """ Unbans a user from the current server. """ try: #Please not that this was used with the old database self.connect() self.query_userID() usridthing = str(member) if usridthing in self.existing_users: query = self.cursor.execute( "DELETE FROM `discord_ban` WHERE `userID`='" + str(member) + "'") self.connection.commit() self.disconnect() else: return () await ctx.guild.unban(discord.Object(id=member), reason=default.responsible( ctx.author, reason)) await ctx.send(default.actionmessage("unbanned")) except Exception as e: await ctx.send(e)