Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm creating a bot that allows users to create embedded messages. Here is a command that I am working with:

    @bot.command()
async def embed(ctx,title_str,text_str,url_str):
    embed=discord.Embed(title=title_str, url=url_str, description=text_str, color=0xFF5733)
    await ctx.send(embed=embed)

This works fine, but if a video is linked I'd like it to add a preview image - in the same way it does if you post a Youtube link I tried adding image = video_url to the discord.Embed command, but this did not help.

Clearly discord is able to do this because when you type in a url to a video you get a preview in an embed automatically generated.

question from:https://stackoverflow.com/questions/65830723/how-do-you-create-a-discord-bot-that-creates-embeds-which-contain-previews-of-vi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Per the Discord API docs: "For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images."

Therefore, you cannot assign a video to Embeds via the API.

See: https://discord.com/developers/docs/resources/channel#create-message


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...