#Having trouble attaching local image to an embed

1 messages · Page 1 of 1 (latest)

teal aspen
#

Plz post your code. You may think you have followed the tutorial 💯 but it helps us verify 🙂

turbid needle
#

my bad

#

pasting:

#
embed = discord.Embed(title="Test!")
embed.set_image(url="attachment://image.png")
file = discord.File("test.png", filename="image.png")
await ctx.send(file=file, embed=embed)
#

that's in a slash command that does nothing else, fwiw

teal aspen
#
@bot.command(name="test", description="Admin only")
async def test(ctx):
    if str(ctx.author) in approved_users:

        embed = discord.Embed(title="Title", description="Desc", color=0x00ff00) #creates embed
        file = discord.File("giphy1.gif", filename="giphy1.gif")
        embed.set_image(url="attachment://giphy1.gif")
        await ctx.send(file=file, embed=embed)
turbid needle
#

is there importance to opening the file before the set_image call or something?

teal aspen
#

Try it like that and see if it works.

#

btw desc and color is optional this is just from my example that works:

turbid needle
#

ill try copying it word for word, idk what else to do :C

#

thanks for helping btw (:

#

cant get it to work, what the hell :C I'll try with a channel instead

#
  2     @slash_command(name="embedtest",
  1                     description="embed image test")
46      async def embedtest(
  1             self,
  2             ctx : DiscordCommandContext,
  3     ):
  4         embed = discord.Embed(title='test', description='test', color=0x00f00)
  5         img = discord.File('image.png', filename="image.png")
  6         embed.set_image(url="attachement://image.png")
  7
  8         await ctx.channel.send(file=img, embed=embed)
#

same error : (

#

what am i missing, geez

hollow ingot
#

Wrong spelling

turbid needle
#

o

#

m

#

g

#

tunnel vision rekt me

#

indeed that was it. im a moron

#

thanks @hollow ingot