【发布时间】:2020-07-07 16:48:24
【问题描述】:
我一直在尝试制作一个显示一些信息的命令,然后,当我对表情做出反应时,它应该显示另一组信息。
我尝试使用 this 的部分内容,特别是第 335 到 393 行中的部分 让它工作。但是,它什么也不做。甚至没有错误消息。
这是我现在使用的代码。
def check_react(reaction, user):
if reaction.message.id != msg.id:
return False
if user != ctx.message.author:
return False
return True
res, user = await bot.wait_for('reaction_add', check=check_react, timeout=None,)
if user != ctx.message.author:
print('if user != ctx.message.author:')
elif '⬅️' in str(res.emoji):
page -=1
print(page)
embed = discord.Embed(title='generic title', description='generic description', color=0x52fffc)
await msg.edit(embed=embed)
elif '➡️' in str(res.emoji):
page +=1
print(page)
embed = discord.Embed(title='generic title 2', description='generic description 2', color=0x52fffc)
await msg.edit(embed=embed)
好像停在了
等待 bot.wait_for('reaction_add', ..)
这是为什么呢?我怎样才能使代码工作?顺便说一句,那是齿轮。如果需要,我很乐意提供更多代码。
【问题讨论】:
-
“它似乎停在:await bot.wait_for('reaction_add)'”。该函数等待一个reaction_add。或者换句话说,它停在那条线上。
标签: discord.py