Discord.Net - C# Downloading An Attachment
14:43 17 Mar 2022

So basically, I have this code where my bot downloads the URL sent with the command.

    [Command("jpg")]
    private async Task Jpg([Remainder] string text)
    {
        string filetype = Path.GetExtension(text);
        if (!text.StartsWith("http") || !text.StartsWith("https"))
        {
            return;
        }
        using (var client = new WebClient())
        {
            client.DownloadFileAsync(new Uri(text), "img\\a" + filetype);
        }
/* Image stuff etc */
    }

I'd like to make it so it grabs the image attachment from the message instead of relying on the URL, but trying to use Context.Message.Attachments gives me an error.

c# discord discord.net