suggestEmbed.add_field(name='Ticket ID: ', value = f'{uniqueID}', inline=False)
message = await channel.send(embed = suggestEmbed)
await message.add_reaction('✅')
await message.add_reaction('❌')
sendEmbed.set_author(name = f'suggested by {ctx.message.author}', icon_url = f'{ctx.author.avatar_url}')
sendEmbed.timestamp = datetime.utcnow()
def check (reaction, user):
return not user.bot and message == reaction.message
try:
reaction, user = await bot.wait_for('reaction_add',check=check,timeout=604800)
while reaction.message == message:
if str(reaction.emoji) == "✅":
await ctx.send("??? Yay! Your suggestion has been approved, We thank you for your valuable time!")
await channel.send(f'suggestion of {ctx.message.author}, with ID: {uniqueID} has been approved, this post will no longer be active')
return
if str(reaction.emoji) == "❌":
await ctx.send("?♀️?♀️ Sorry! Your suggestion has not been approved, We thank you for your valuable time!")
message1 = await ctx.send(embed = sendEmbed)
await channel.send(f'suggestion of {ctx.message.author}, with ID: {uniqueID} has not been approved, this post will no longer be active')
return
except asyncio.TimeoutError:
await ctx.send("Your suggestion was timed out. Please try again!")
return
我想知道对我的嵌入做出反应的人的角色/用户名。 (使用 dicord.py 制作的)。有没有办法使用ctx访问它?或任何其他我不知道的方式。
答案 0 :(得分:0)
由于您从 user
获得 bot.wait_for
,因此您只需使用以下两种方法之一访问用户名:
username = user.display_name
#or
username = user.name
以及您可以使用的角色:
roles = user.roles #user.roles returns a list because the user can have multiply roles.
#Attention! This will raise an error if the reaction was in a dmchannel