How to use Embedding with C#? Discord BOT

Zack Arnett picture Zack Arnett · May 9, 2017 · Viewed 11.8k times · Source

I am looking to embed the following: Embed Pic

Using the Discord API. I have looked and the only resources I can find are for Python, Java, Ruby, etc.

But when using:

var embed = new Message.Embed(
{
    Author =
    {
        Name = "Name",
        Url = "www.url.com"
    }
});

It comes back with the message:

Error on MEssage.Embed

And:

Error on Name and URL

Not sure What I need to do to be able use the embed library. Just looking for some guidance on how this works

Edit:

When Using this I get no errors but when running the embed doesnt seem to build. It doesnt error. It just never builds the embed variable

var embed = new Message.Embed
            {
                Author =
                {
                Name = "Lawler",
                Url = "www.twitch.tv/Lawler"
                },
                Title = "www.twitch.tv/Lawler",
                Thumbnail =
                {
                ProxyUrl = "https://yt3.ggpht.com/-m-P7t2g-ecQ/AAAAAAAAAAI/AAAAAAAAAAA/YtS2YsD8-AM/s900-c-k-no-mo-rj-c0xffffff/photo.jpg",
                Url = "www.twitch.tv/Lawler"
                },
                Description = "**Now Playing**\n" +
                              "Rocket League\n" +
                              "**Stream Title**\n" +
                              "Lawler RLCS Caster"

            };

*Note: I am using Discord v 0.9.6

Answer

Adam Schiavone picture Adam Schiavone · May 9, 2017

Just a quick look at your code, I think you've got a close parenthesis in the wrong place.

Try the following:

var embed = new Message.Embed()
{
    Author =
    {
        Name = "Name",
        Url = "www.url.com"
    }
};

Again, without doing any research you may also need to do the following:

var embed = new Message.Embed()
{
    Author = new Author()
    {
        Name = "Name",
        Url = "www.url.com"
    }
};