Home > database >  How do I add an image for a Discord bot in c#?
How do I add an image for a Discord bot in c#?

Time:02-04

This is what I think that should work

I'm doing a bot for discord and I'm new to this, still trying to understand basics. I would like to add an image with out any message attached, how do i do this?

public class Command : ModuleBase<SocketCommandContext>
{
    [Command("Image")]
    public async Task ReplyImage()
    {
        await ReplyAsync("image.url");
    }
}

CodePudding user response:

You must embed the image
example :

public class Command : ModuleBase<SocketCommandContext>
{
    public async Task ReplyImage()
    {
        var embed = new EmbedBuilder();
        embed.WithImageUrl("image.url");
        await ReplyAsync("", false, embed.Build());
    }
}
  • Related