Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.7k stars 3.74k forks source link

Is there a way to post a local image? #584

Closed adhoc92 closed 7 years ago

adhoc92 commented 7 years ago

Posting an image link is easy:

@bot.group(pass_context=True)
async def john(ctx):

    if ctx.invoked_subcommand is None:
        await bot.say('https://i.imgur.com/rZWO3QB.png'.format(ctx))

But changing the URL to something like C:/blah/blah/blah.png obviously doesn't work. Is it possible?

slice commented 7 years ago

Please read the documentation. http://discordpy.readthedocs.io/en/latest/api.html#discord.Client.send_file

sgtlaggy commented 7 years ago

bot.upload is the commands ext equivalent of Client.send_file.

Armster15 commented 4 years ago

For posting a local image in an embed, see this StackOverflow thread: https://stackoverflow.com/questions/61578927/use-a-local-file-as-the-set-image-file-discord-py/61579108#61579108

(It's compatible with the rewrite of discord.py)