OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

discord_webhook python library not putting image into the embed

  • Thread starter Thread starter user18191682
  • Start date Start date
U

user18191682

Guest
I have been trying to make my webhook send an embed with some text along with an image as well, which I am using the discord_webhook library for. Unfortunately, every time I send the embed and the image, they come off as separate, even though I send them in the same execute call.

Here is my code:

Code:
webhook = DiscordWebhook(url=webhook_url, username="Test")

embed = DiscordEmbed()
embed.set_title("Test")
with open("Image.png", "rb") as f:
    webhook.add_file(file=f.read(), filename="Image.png")
embed.add_embed_field(name="Text", value="Yay", inline=True)
webhook.add_embed(embed)
response = webhook.execute()

I tried using set_image but it didn't work D: Help would be appreciated :D
<p>I have been trying to make my webhook send an embed with some text along with an image as well, which I am using the discord_webhook library for. Unfortunately, every time I send the embed and the image, they come off as separate, even though I send them in the same execute call.</p>
<p>Here is my code:</p>
<pre><code>webhook = DiscordWebhook(url=webhook_url, username="Test")

embed = DiscordEmbed()
embed.set_title("Test")
with open("Image.png", "rb") as f:
webhook.add_file(file=f.read(), filename="Image.png")
embed.add_embed_field(name="Text", value="Yay", inline=True)
webhook.add_embed(embed)
response = webhook.execute()
</code></pre>
<p>I tried using set_image but it didn't work D:
Help would be appreciated :D</p>
 

Latest posts

Online statistics

Members online
0
Guests online
5
Total visitors
5
Top