Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.33 KB | None | 0 0
  1. @commands.command(pass_context=True, no_pm=True, name='list', aliases=['roles', 'role'])
  2.     async def _list(self, ctx):
  3.         """List of all available roles """
  4.         guild = ctx.message.guild
  5.         author = ctx.message.author
  6.         botroom = self.bot.get_channel(555844758778544160)
  7.         intros = self.bot.get_channel(485381365366390796)
  8.          #--- Role list Categories ---"
  9.         Colours = ['Blue', 'Green', 'Orange', 'Yellow', 'Pink', 'Purple']
  10.         Colours.sort(key=str.lower)
  11.        
  12.         Games = ['LoL', 'WoW', 'Overwatch']
  13.         Games.sort(key=str.lower)
  14.        
  15.         Platforms = ['PC', 'Xbox', 'PS4', 'Nintendo Switch']
  16.         Platforms.sort(key=str.lower)
  17.        
  18.        
  19.         if ctx.message.channel == intros:
  20.             pass
  21.         else:
  22.             if ctx.message.channel == botroom:
  23.                 title = '**Hey {}, here is a list of roles you can add:**'.format(author.display_name)
  24.                 embed = discord.Embed(title=title.format(), colour=0x0080c0)
  25.                 embed.add_field(name="**Have a role suggestion?**", value="If you can't find the role you want but would like to see it added to the roles list please tell us in <#555371532390760473>.", inline=False)
  26.                 embed.set_footer(text="Tip: to add a role from the list type the command !add/remove followed by the role.")
  27.                
  28.                 #Lets start embed roles list below#
  29.                
  30.                 for role in Colours:
  31.                     embed.add_field(name="**Colour Roles**", value="""\n{} **({})**""".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])), inline=True)
  32.                    
  33.                 for role in Games:
  34.                     embed.add_field(name="**Game Roles**", value="""\n{} **({})**""".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])), inline=True)
  35.  
  36.                 for role in Platforms:
  37.                     embed.add_field(name="**Plaforms Roles**", value="\n{} **({})**".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])), inline=True)
  38.                 await ctx.send(embed=embed)
  39.             else:
  40.                 await ctx.send('You can only use this command in {}.'.format(botroom.mention))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement