从嵌入式消息中获取内容?

Posted

技术标签:

【中文标题】从嵌入式消息中获取内容?【英文标题】:Get content from emeded message? 【发布时间】:2021-05-24 06:29:08 【问题描述】:

所以我正在尝试制作一个“退出提醒机器人”

但是 disboard 发送了一条我不明白如何使用我的自定义机器人阅读的消息... 这就是我所拥有的:但它只是用于纯文本..

@bot.event
async def on_message(message):
  if "Check it on DISBOARD:" in message.content: #and message.author.id == 302050872383242240:
    print("I see the bump!")
    await message.add_reaction(emoji='⏱️')
    print("counting now!")
    await asyncio.sleep(7200)
    print("sending reminder!")
    await message.channel.send("Remember to bump the server!")

【问题讨论】:

这能回答你的问题吗? (Discord.py) How can I get the entire embed content? 【参考方案1】:

您需要检查嵌入的描述

@bot.event
async def on_message(message):
  if message.author.bot and message.embeds:
    if "Check it on DISBOARD:" in message.embeds[0].description: #and message.author.id == 302050872383242240:
      print("I see the bump!")
      await message.add_reaction(emoji='⏱️')
      print("counting now!")
      await asyncio.sleep(7200)
      print("sending reminder!")
      await message.channel.send("Remember to bump the server!")

【讨论】:

以上是关于从嵌入式消息中获取内容?的主要内容,如果未能解决你的问题,请参考以下文章