【发布时间】:2019-05-12 11:13:38
【问题描述】:
我正在从服务器捕获嵌入,我想将嵌入转发到直接消息。
所以我像这样嵌入:
@client.event
async def on_message(message):
embed = message.embeds[0]
现在我修复了嵌入,以便它们可以发送给 DM。因为它们的格式不正确。
我尝试使用带有 Webhook 的 requests.post 发送到“嵌入”频道,它可以正常工作。
当我尝试向 DM 发送“嵌入”时,它不起作用。
webhook_url = 'https://discordapp.com/api/users/{}/{}'.format(user_id, token_bot)
def sendToDiscord(webhook_url, embed):
headers = {
'Content-Type': 'application/json',
}
response = requests.post(webhook_url, data= embed, headers=headers)
return response
所以真正的问题是如何通过请求发送 POST 嵌入?
【问题讨论】:
-
为什么不使用
client.send_message将嵌入发送到频道? -
因为它是另一种格式
标签: python-3.x bots discord discord.py