简体   繁体   English

如何在嵌入消息中使用from_dict函数?

[英]How to use the from_dict function in Embed messages?

I wanted to make a command !say [json] to send Embed messages. 我想发出命令!say [json]发送嵌入消息。 I found in discordpy.readthedocs the from_dict function. 我在discordpy.readthedocs中找到了from_dict函数。

Now, I don't know how to use it. 现在,我不知道如何使用它。 I hope for your help. 希望对您有所帮助。

Sorry for Google Translate :3 对不起,Google翻译:3

Talking about this ? 谈论这个

So what this does is get embed from dictionary, here is an example: 因此,这是从字典中嵌入的,下面是一个示例:

@bot.command()
async def embed(ctx, *,title):
    e=discord.Embed.from_dict({
        "title":f"{title}",
        "description":"This is the embed description"
    })
    await ctx.send(embed=e)

See the output in that Image 查看该图像中的输出

这是输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM