async def pending(ctx, role):
msg = message = str(ctx.message.content).replace(':pending ', '')
role = msg
print(role)
roles = [
699429967359901766,
718980142248099850,
872855873213591612,
937144816351993886
]
author = ctx.message.author
author_roles = []
for role in author.roles:
author_roles.append(role.id)
flag = False
for role in author_roles:
if role in roles:
flag = True
if flag == True:
msg = await ctx.channel.fetch_message(ctx.message.reference.message_id)
embeds = msg.embeds # return list of embeds
i = 0
embed = embeds[0]
flag = True
index = 2
embed_members = []
while(flag):
try:
users = embed.to_dict()['fields'][index]['value'].replace('>>>','')
index = index+1
users = users.split('\n')
for user in users:
embed_members.append(user)
except:
flag = False
users = format_list(users= embed_members)
member_roles = []
print(role)
guild = ctx.guild
role = discord.utils.get(guild.roles,name=role)```
#discord.role issue
1 messages · Page 1 of 1 (latest)
@hoary thicket
Here is where it isn't working
bot.command(pass_context = True)
async def getEmbed(ctx):
msg = str(ctx.message.content).replace(':getEmbed ', '')
role = msg
guild = ctx.guild
role = discord.utils.get(guild.roles,name=role)
print(role.members)
msg = await ctx.channel.fetch_message(ctx.message.id)
await msg.delete()
i think it's because you keep overriding the role variable
you should use different variable names
also thispy msg = message = str(ctx.message.content).replace(':pending ', '') role = msg...isn't needed at all?
you should set your command arguments to (ctx, *, role) if you want to properly support spaces
yes i'll do that but this is like an instant deadline in like 15 minutes