【发布时间】:2020-08-25 11:58:51
【问题描述】:
我已经写了一个命令。当您执行此命令时,机器人会向特定频道发送消息。他对此消息添加了一个反应(顺便说一句嵌入)。到目前为止。但是现在,当有人点击这个反应时,我希望机器人做出反应。在这种情况下,他应该向特定频道发送消息。但这不起作用。也没有错误码,应该是可以的,只是他没有发消息。
@bot.command()
async def buy(ctx, choice):
channel = bot.get_channel(705836078082424914)
user = ctx.message.author
vcrole1 = get(user.guild.roles, id=703562188224331777)
messagechannel = ctx.message.channel.id
if ctx.message.channel.id == 705146663135871106:
if choice == '1':
if any(role.id == 703562188224331777 for role in ctx.message.author.roles):
await user.remove_roles(vcrole1)
await ctx.send(
"not important message")
messtag1 = await channel.send('not important')
await messtag1.delete(delay=None)
embed = discord.Embed(color=0xe02522, title='not important title', description=
'not important description')
embed.set_footer(text='not important text')
embed.timestamp = datetime.datetime.utcnow()
mess1 = await channel.send(embed=embed)
await mess1.add_reaction('<a:check:674039577882918931>')
def check(reaction, user):
return reaction.message == mess1 and str(reaction.emoji) == '<a:check:674039577882918931>'
await bot.wait_for('reaction_add', check=check)
channeldone = bot.get_channel(705836078082424914)
await channeldone.send('test')
没有错误消息。
【问题讨论】:
-
输出中有错误信息吗?
-
不,没有错误信息。
标签: python discord.py