【问题标题】:Discord.py adding reaction to webhook.send messageDiscord.py 添加对 webhook.send 消息的反应
【发布时间】:2021-08-28 23:08:30
【问题描述】:

我可以很容易地通过 webhook 向我的 discord 频道发送消息,但是,考虑到我的编程仍然很琐碎,尝试对消息添加反应时非常困难。

我现在的代码行是:

data_count=1
webhook.send(content=discord.Reaction(message="test", data=data_count, emoji="????"), file=discord.File("american_eagle_excited.gif"), embed=discord.Embed(title="Sample Embed", description="This is the description"))

一切,当我分解参数时,除了 discord.Reaction 类之外,我还可以开始工作。我觉得我很容易错过一些东西,在尝试通读课程要求后,我不得不最终进入 StackOverflow。

【问题讨论】:

    标签: discord discord.py


    【解决方案1】:

    要添加反应,您需要webhook.send 方法返回的discord.Message 实例,然后使用message.add_reaction 添加反应

    message = webhook.send("test", wait=True, ...)  # `wait=True` is really important, if we don't set this the bot will not wait for the message to be returned
    await message.add_reaction("?")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-06
      • 2020-10-27
      • 2020-11-07
      • 2020-03-03
      相关资源
      最近更新 更多