I am trying to get the URL of the file that the user attaches so I can use it later on in my code however I'm not too sure on how to go about doing so.
@client.command(pass_context=True)
async def readURL(ctx, url):
# Do something
References:
If I'm understanding the question correctly, it would go like this:
@client.command() # context is automatically passed in rewrite
async def readURL(ctx):
attachment = ctx.message.attachments[0] # gets first attachment that user
# sent along with command
print(attachment.url)
References:
Attachment.urlMessage.attachmentsIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With