async def delete(self, ctx, *, rolename: str): roleobj = discord.utils.get(ctx.guild.roles, name=rolename) if Database.isfunrole(ctx.guild.id, roleobj.id): Database.removefunrole(ctx.guild.id, roleobj) if Database.isfunrole(ctx.guild.id, roleobj.id): return await ctx.message.add_reaction(emoji=redxemoji) else: return await ctx.message.add_reaction(emoji=checkmarkemoji) else: return await ctx.message.add_reaction(emoji=redxemoji)
async def leave(self, ctx, *, rolename: str): roleobj = discord.utils.get(ctx.message.guild.roles, name=rolename) if roleobj is None: await ctx.send("Oops that role doesn't exist.") # debug purposes return await ctx.message.add_reaction(emoji=redxemoji) if roleobj in ctx.author.roles and Database.isfunrole(ctx.guild.id, roleobj.id): await ctx.message.author.remove_roles(roleobj) return await ctx.message.add_reaction(emoji=checkmarkemoji) else: return await ctx.message.add_reaction(emoji=redxemoji)
async def massdelete(self, ctx, *rolename: discord.Role): rolesremoved = [] rolesnotremoved = [] for role in rolename: Database.removefunrole(ctx.guild.id, role) if Database.isfunrole(ctx.guild.id, role.id): rolesnotremoved.append(role.name) else: rolesremoved.append(role.name) await ctx.message.add_reaction(emoji=checkmarkemoji) return await ctx.send(f"Roles successfully removed: {rolesremoved} \n Unsuccesss: {rolesnotremoved}")