python-3.x - 发送消息并嵌入 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!")
解决方案
再看一下Client.send_message
文档。您需要分别给它参数destination
,content
和embed
,而不是加在一起。
@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)
推荐阅读
- python-3.x - 熊猫中的分组列
- python - 我该如何解决 - TypeError:无法安全地将非等效 float64 转换为 int64?
- android - 从 DataSource 更新 List 后,在 PagedListAdapter 中保留先前更新的 Item
- c - 打印主要的优先级
- javascript - 用户尝试退出时使用回调提示
- azure - 在 Azure Python SDK 中实例化 Databricks 时如何提供序列化程序、反序列化程序和配置参数?
- database - 红移光谱 - 更新外部光谱表列类型
- c# - 如何配置 AutoMapper 仅在特定场景下处理类型转换?
- css - Vuetify 按钮未垂直对齐
- flutter - 如何在最后夹住滚动视图和容器