async def on_member_update(before, after): if before.nick == after.nick: return elif after.nick == None: return if after.nick.startswith('!'): if not Dashboard.getDehoister(after.guild.id): return try: await after.edit(nick='Dehoisted user') except: pass
async def dehoister(self, ctx, *args): if not ctx.author.guild_permissions.manage_nicknames: return await ctx.send('{} | You need the `Manage Nicknames` permissions!'.format(str(self.client.get_emoji(BotEmotes.error)))) data = Dashboard.getDehoister(ctx.guild.id) if not data: Dashboard.setDehoister(ctx.guild, True) return await ctx.send(embed=discord.Embed( title='Activated dehoister.', description=f'**What is dehoister?**\nDehoister is an automated part of this bot that automatically renames someone that tries to hoist their name (for example: `!ABC`)\n\n**How do i deactivate this?**\nJust type `{Config.prefix}dehoister`.\n\n**It doesn\'t work for me!**\nMaybe because your role position is higher than me, so i don\'t have the permissions required.', color=discord.Colour.from_rgb(201, 160, 112) )) Dashboard.setDehoister(ctx.guild, False) await ctx.send('{} | Dehoister deactivated.'.format(self.client.get_emoji(BotEmotes.success)))
async def on_member_join(member): # SEND WELCOME CHANNEL welcome_message, welcome_channel = Dashboard.send_welcome( member, discord), Dashboard.get_welcome_channel(member.guild.id) if welcome_message != None and welcome_channel != None: await member.guild.get_channel(welcome_channel).send( embed=welcome_message) data = Dashboard.add_autorole(member.guild.id) if data.isnumeric(): # AUTOROLE await member.add_roles(member.guild.get_role(int(data))) if member.name.startswith('!'): if not Dashboard.getDehoister(member.guild): return try: await member.edit(nick='Dehoisted user') except: pass