Discord bot get photo from user message

Viewed 571

Heyyy I just was wondering how you can send an image to a channel and have the Discord bot add the image to a list of files it can send.

I want to make a !meme command where you can add photos via sending them and typing a command like !add-meme. It will save the photo and display a random one when you send !meme

Is this possible?

1 Answers

Yes, it's possible, but you would need an understanding of the discord py documents & a basic understanding of python.

@client.command() 
async def readMessageURL(ctx):
    string = ctx.message.attachments[0]
    
 @client.command() 
    async def send(ctx):
      await TextChannel.send(file=discord.File('path/to/image.png')) #or
      await TextChannel.send(url=string))

Refrence:

Related