【问题标题】:How can I get the description of an embed and send it into another channel in a async def on_reaction_add function如何获取嵌入的描述并将其发送到 async def on_reaction_add 函数中的另一个通道
【发布时间】:2022-07-01 08:28:06
【问题描述】:

我试图做一些投票命令,当达到一定数量的投票时将投票内容发送到另一个频道,我在将结果发送到另一个频道时遇到问题:

@commands.Cog.listener()
async def on_reaction_add(self,reaction, user):
    if reaction.count == 2 and reaction.emoji == "✅":
        await reaction.message.reply(f"Votacion Aceptada")
    elif reaction.count == 2 and reaction.emoji == "❌":
        await reaction.message.delete()

除了具有 ✅ 我需要发送已通过 ID 对频道作出反应的嵌入描述的部分外,此方法有效,我该怎么做?如果不问我如何在频道进入if reaction.count == 2 and reaction.emoji == "✅": 部分之前检查频道?

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    将您的输出发送到另一个频道非常容易。

    首先,您提供要将消息传递到的频道 ID:

    another_channel = bot.get_channel(int(CHANNEL_ID_HERE))
    

    然后你发送消息:

    await another_channel.send(reaction.message.content)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 2021-02-26
      • 1970-01-01
      • 2021-08-01
      • 2020-07-30
      • 2018-11-24
      • 1970-01-01
      相关资源
      最近更新 更多