in Education by
Hi I'm having an issue trying to display a symbol that denotes a role that can be mentioned in Discord. I'm currently using discord.py and they use role.mentionable which is a Boolean https://discordpy.readthedocs.io/en/rewrite/api.html#discord.Role.mentionable What I'm trying to accomplish and failing to do is being able to set add :bell: in front of the role that is mentionable while :nobell: for the roles that are not. I get the error AttributeError: 'str' object has no attribute 'mentionable' Here is the code I'm working with: @commands.command(pass_context=True, no_pm=True, name='list', aliases=['roles', 'role']) async def _list(self, ctx): """List of all available roles """ guild = ctx.message.guild author = ctx.message.author botroom = self.bot.get_channel(555844758778544160) intros = self.bot.get_channel(485381365366390796) #--- Role list Categories ---" if ctx.message.channel == intros: pass else: if ctx.message.channel == botroom: title = '**Hey {}, here is a categorised list of roles you can add:**'.format(author.display_name) embed = discord.Embed(title=title.format(), colour=0x0080c0) embed.add_field(name="\n**__Notifications__**", value="roles with a :bell: at the beginning of them are @mentionable - when applied you may recieve notifications.\n\n", inline=False) embed.set_footer(text="Tip: to add a role from the list type the command !add/remove followed by the role.") #Lets start embed roles list below# #Colours Colours = ['Blue', 'Green', 'Orange', 'Yellow', 'Pink', 'Purple'] Colours.sort(key=str.lower) embed.add_field(name='**__Colour Roles__**', value='\n'.join([":bell: {} **({})**" if role.mentionable in Colours else ":no_bell: {} **({})**".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])) for role in Colours])) await ctx.send(embed=embed) else: await ctx.send('You can only use this command in {}.'.format(botroom.mention)) More specifically the error is on this line within the code embed.add_field(name='**__Colour Roles__**', value='\n'.join([":bell: {} **({})**" if role.mentionable in Colours else ":no_bell: {} **({})**".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])) for role in Colours])) I'm not sure what to do from here. Help much appreciated. Edit: reply @Kanasaki Torisowa Colours = ['Blue', 'Green', 'Orange', 'Yellow', 'Pink', 'Purple'] Colours.sort(key=str.lower) for role in guild.roles: if role.mentionable in Colours == True: embed.add_field(name='**__Colour Roles__**', value='\n'.join(["{} **({})**".format(role, len([member for member in guild.members if ([r for r in member.roles if r.name == role])])) for role in Colours])) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

Related questions

0 votes
    Hi I'm having some issues showing lists in my embed correctly. I'm trying to get my roles to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to log the user session. Currently the code is as follows (setting formatter and handlers is omitted ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I want to log the user session. Currently the code is as follows (setting formatter and handlers is omitted ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    I want to log the user session. Currently the code is as follows (setting formatter and handlers is omitted ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I want to log the user session. Currently the code is as follows (setting formatter and handlers is omitted ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    I am reading a yaml file like so in Python3: def get_file(): file_name = "file.yml" properties_stream ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I have the following data-frame: -- dcc.Dropdown for selecting the issue goes here on the page -- ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How are lambdas useful? [closed] (26 answers) Closed 3 years ago ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 15, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How are lambdas useful? [closed] (26 answers) Closed 3 years ago ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How are lambdas useful? [closed] (26 answers) Closed 3 years ago ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I'm Running Ubuntu 16.04 LTS with Python 3.6.8 and I have the following code that allows me to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    Good day to you, Today I was moving code from threading to multiprocess. Everything seemed okay, until I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have a dictionary d full of a collection of dataframes: key type size value gm1 dataframe mxn .. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    i want to create a new layer using scapy,i created a new layer but when i sent it to another ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I've created a python3 script that runs fine on command line but when I try to run as a daemon ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
...