'How to get/save the attachment in a slash command?

What I'm trying to do here is get the url or raw file of a slash command attachment. Being the inexperienced person that I am, I've ran into some issues. On discord's side, it gets the option type and shows the attachment prompt. But when a user sends a command with an attachment, all I get is a string of some numbers (966169863519350854). I don't know if I'm missing something or doing it the wrong way. Below is my code and and what is printed in the console.

import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option

client = commands.Bot(command_prefix="!")
slash = SlashCommand(client, sync_commands=True)

@slash.slash(
        name="identify",
        description="Identify Image",
        guild_ids=[805487639443931136],
        options=[
            create_option(
                name="image",
                description="Attach an Image",
                required=True,
                option_type=11, #Attachment
            )
        ]
)
async def _identify(ctx:SlashContext, image):
    print(type(image))
    print(image)

client.run('')

Console Output:

<class 'str'>
966169863519350854

Thank you!



Solution 1:[1]

I ended up switching over to interactions.py. Since an attachment is a class, I did image.url which got me the url of said attachment.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aa-ron