i’m trying to get the url of image when i do the command +coin but I d’ont know if I do it right.
if someone can help me i’ll very appreciate it.
@Bot.command()
async def coin():
print(message.attachments[0].url)
await ctx.send("work")
>Solution :
Your close for that to work you first need to get the ctx
in your function like this then you need to get the URL that the user sent. The way that I would do it is like this.
async def coin(ctx):
This will create the function.
Then it is simply getting the rest of the code set up for that image.
The rest of the code should look like this
print(ctx.message.attachments[0].url)
await ctx.send("work")
Here is an example of the full code:
@bot.command()
async def coin(ctx):
print(ctx.message.attachments[0].url)
await ctx.send("work")