【问题标题】:Discord Py, discord bot get message content of another bot/embed/webhookDiscord Py,discord bot 获取另一个 bot/embed/webhook 的消息内容
【发布时间】:2020-08-17 00:23:45
【问题描述】:

当它从 webhook/bot/embed 获取消息内容时,它总是会发送一个空白行/空格,我想知道我的 discord bot 是否有可能看到这些 webhook/bot/embed 的内容.

import discord

client = discord.Client()

@client.event
async def on_ready():
    print('Logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author.bot == True:
        print(message.content)

【问题讨论】:

  • 你发现了吗?试图让一个 webhook 与我的机器人通信,但它根本没有接收到它。
  • 我不认为机器人能够看到嵌入,可能你可以做的是使用你自己帐户或第二个帐户的不和谐令牌并使用它来查看嵌入的消息。这将需要一些逆向工程并查看页面请求并尝试复制 api。

标签: python discord


【解决方案1】:

获取嵌入

if len(message.embeds) > 0:
    embed = message.embeds[0] #you can do embed.title to get the title and other details of the embed now

获取另一条机器人消息

if message.author.bot and message.author != client.user:
    msg = message.content

获取 webhook 消息

if message.webhook_id:
    msg = message.content

【讨论】:

    猜你喜欢
    • 2021-06-15
    • 2021-06-17
    • 1970-01-01
    • 2019-07-04
    • 1970-01-01
    • 2021-03-27
    • 2021-08-27
    • 2021-08-12
    • 2022-11-17
    相关资源
    最近更新 更多