user6809531
user6809531

Reputation:

Discord.net bot Embed Message

I am trying to implement embedded messages for my bot. I know that I need to fill an Embed Object with the specific informations. But how can I send it to the Channel? When I use e.Channel.SendMessage(string); it can't send an Embed object, it will just send strings.

Upvotes: 3

Views: 22713

Answers (3)

Vlad Setchin
Vlad Setchin

Reputation: 121

With Discord.Net 2.0.1 syntax will look a little different.

EmbedBuilder builder = new EmbedBuilder();

builder.WithTitle("Ice Wizard Stats");
builder.AddField("Cost", "3", true);    // true - for inline
builder.AddField("HP", "665", true);
builder.AddField("DPS", "42", true);
builder.AddField("Hit Speed", "1.5sec", true);
builder.AddField("SlowDown", "35%", true);
builder.AddField("AOE", "63", true);
builder.WithThumbnailUrl("http://...");

builder.WithColor(Color.Red);
await Context.Channel.SendMessageAsync("", false, builder.Build());

Upvotes: 5

datboi
datboi

Reputation: 198

var eb = new EmbedBuilder();
eb.WithDescription("some text");
await Context.Channel.SendMessageAsync("", false, eb.Build());

In Discord.NET 1.0.

0.9.6 doesn't support embeds.

Upvotes: 8

user7501172
user7501172

Reputation:

You need to use Discord.net 1.0 Here is an example showing EmbedBuilder()

var builder = new EmbedBuilder();

builder.WithTitle("Ice Wizard Stats");
builder.AddInlineField("Cost", "3");
builder.AddInlineField("HP", "665");
builder.AddInlineField("DPS", "42");
builder.AddInlineField("Hit Speed", "1.5sec");
builder.AddInlineField("SlowDown", "35%");
builder.AddInlineField("AOE", "63");
builder.WithThumbnailUrl("url");

builder.WithColor(Color.Red);
await Context.Channel.SendMessageAsync("", false, builder);

Sorry I am a Clash fanatic. The await Context.Channel.SendMessageAsync("", false, builder); sends the Embed to the channel :).

Upvotes: 2

Related Questions