为什么来自机器人的消息的响应列表没有显示在终端中?

时间:2020-07-06 22:32:26

标签: python discord.py

所以我正在制作一个可以帮助表情符号建议的机器人,但是我需要响应部分的帮助,因为我无法获得该消息的响应列表。这是一些代码:

suggestion = await ctx.send(embed=embed)

await suggestion.add_reaction('?')
votes = suggestion.reactions
print(votes)

因此,当我运行漫游器并使用命令运行该代码段时,反应会立即显示出来,但是终端会打印出[],从逻辑上讲,这出于某种原因意味着没有投票。我在做什么错了?

此外,这是为您自己运行它的代码:

client = discord.Client()
bot = commands.Bot(command_prefix='suggestemoji ')

@bot.command()
async def suggest(ctx, name):
    max = 2
    author = ctx.message.author.name
    attachment_url = ctx.message.attachments[0].url
    embed = discord.Embed(title="New suggestion!", description=f"User **{author}** suggested an emoji **:{name}:**!", color=0x37ff00)
    embed.set_thumbnail(url=attachment_url)
    embed.set_footer(text="Bot made by <cut out for personal reasons>")
    suggestion = await ctx.send(embed=embed)

    def check(reaction):
        return str(reaction.emoji) == '?'

    await suggestion.add_reaction('?')
    await asyncio.sleep(5)
    cache_msg = discord.utils.get(client.messages, id=suggestion.id)
    #reaction, user = await client.wait_for('reaction_add', check=check)
    votes = suggestion.reactions
    print(votes)

0 个答案:

没有答案