首页 > 解决方案 > 发送消息并嵌入 1 个命令 (Discord.py)

问题描述

我正在尝试将嵌入的照片发送到不和谐并在其之前发送消息。我已经尝试了几件事,但似乎无法掌握它。

if message.author == client.user:
    return
elif message.content.startswith('!brando'):
    embed = discord.Embed(title="", description="", color=0x32363c)
    embed.set_image(url="embed IMAGEURLHERE.PNG")
    await client.send_message(message.channel + embed=embed +"<@!368718923123456789>s photo!")

标签: python-3.xdiscord.py

解决方案


再看一下Client.send_message文档。您需要分别给它参数destination,contentembed,而不是加在一起。

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    elif message.content.startswith('!brando'):
        embed = discord.Embed(title="", description="", color=0x32363c)
        embed.set_image(url="ImageUrl")
        await client.send_message(message.channel, "<@!368718923123456789>s photo!", embed=embed)

推荐阅读