title: Getting an error when trying to get an attachment url in discord.py
body: <p>I'm trying to make a discord bot that would repost art submissions to the art channel after they are approved by the moderators. Every time I try to extract  the attachment URL, I get this error:</p>
  <pre><code>Ignoring exception in on_message
  Traceback (most recent call last):
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py&quot;, line 343, in _run_event
      await coro(*args, **kwargs)
    File &quot;main.py&quot;, line 32, in on_message
      url = message.attachments[0].url
  IndexError: list index out of range
  </code></pre>
  <p>I tried searching this up on the Internet, but there is nothing. The only thing I found was <a href="https://stackoverflow.com/questions/60153779/discord-py-attachments">this post</a>, but I did everything right. Can someone explain to me what's happening?
  My code:</p>
  <pre><code>@client.event
  async def on_message(message):
    channel = client.get_channel(#id-here)
    channel2 = client.get_channel(#id-here)
    artName = message.content
    attachment = message.attachments[0]
    print(attachment)
  
    embed = discord.Embed(
      title = message.content,
      colour = discord.Colour.red()
    )
    
    embed.set_author(name = message.author,
    icon_url = message.author.avatar_url)
    embed.set_image(url = attachment)
  </code></pre>
  <p>Also, I tried to use <code>message.attachments[0].url</code> but got the same thing</p>