Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload an embed image?

I am wondering how I can make my bot upload an embedded image to a Discord channel. I know how to make it send embeds, but how do I upload an embedded image? Is it even possible with discord.py? Keep in mind I am not referring to the thumbnail image you can have in an embed image, I am wondering if you even can upload an embed image using Python. Thanks!

like image 231
T. Licht Avatar asked Nov 27 '17 16:11

T. Licht


People also ask

What is an embed image?

Definition: Embedding refers to the integration of links, images, videos, gifs and other content into social media posts or other web media. Embedded content appears as part of a post and supplies a visual element that encourages increased click through and engagement.

How do I send an embedded image?

This is the easiest way to embed images into an email without learning how to code. Email providers, like Gmail, allow you to drag an image from a folder and drop it into an area inside the compose box that says “attach files here”.

What does it mean to embed an image in an email?

Embedding an image into an email message is the act of adding the image into the coding of the email template for it to appear amongst the text once the subscriber opens it, instead of appearing as an email attachment.


1 Answers

To send an image in an embed, use the set_image method of the embed:

e = discord.Embed()
e.set_image(url="https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg")

To send a file from your PC, use the send_file method in async branch or the send method in rewrite branch.

# Async
await bot.send_file(channel, "filepath.png", content="...", filename="...")

# Rewrite
file = discord.File("filepath.png", filename="...")
await channel.send("content", file=file)
like image 199
Sam Rockett Avatar answered Sep 30 '22 09:09

Sam Rockett