简体   繁体   中英

How to use the from_dict function in Embed messages?

I wanted to make a command !say [json] to send Embed messages. I found in discordpy.readthedocs the from_dict function.

Now, I don't know how to use it. I hope for your help.

Sorry for Google Translate :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

这是输出

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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