i created a method that takes a screenshot
def send_screenshot_to_discord(self):
webhook=discord_webhooks.DiscordWebhooks("https://discord.com/api/webhooks/xyz")
img=ImageGrab.grab()
webhook.set_image(image=img)
webhook.set_footer(text="img")
webhook.send()
the result :
Unfortunately, the discord_webhooks
package you're using does not support file attachments, making it impossible to set the locally saved images or Pil-created images as embed images.
The way you set local images as embed images is by using attachment://image.png
as the embed.set_image
function's url
argument, and since you cannot attach images, you can't do that.
Here is the FAQ from discord.py
on how to set local images as embed images.
file = discord.File("path/to/my/image.png", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await channel.send(file=file, embed=embed)
Consider using discord_webhook or discord.py
's webhook.