0
votes

The server I made the bot for has an archive channel that stores images.

I wanted to create a bot that reads through the channel and resends the image based on the request. The code is as follows:

@client.event
async def on_message(message):
if message.content.startswith('!archive request'):
      channel = client.get_channel(714768885110538321)
      messages = await channel.history(oldest_first=True).flatten()

      request = ''
      for i in message.content.split():
        if i.isdigit():
          request += i

      await message.channel.send(messages[int(request)].content)

Basically, I want to resend an image that is posted to a specific channel. However, .content seems to result in an empty return. I tried using jump_url, and it sends the proper link, but it seems that discord can't embed images based on message links.

How would I be able to fix this? I would prefer to not store the images if possible.