PsychoTea / Oxide.Ext.Discord

Discord extension and integration
https://umod.org/extensions/discord
12 stars 25 forks source link

Embed Message #38

Closed MadLad1Clip closed 5 years ago

MadLad1Clip commented 6 years ago

Could I get some help on how to change a standard message to an embedded message? I have worked out a lot with this plugin but really not quite understanding how to set an embedded message and I would really like this for notifications.

MadLad1Clip commented 5 years ago

Any chance of getting some support with this?

Slut commented 5 years ago
            Embed embed = new Embed
            {
                title = "hey",
                fields = new List<Field>
                {
                    new Field
                    {
                        name = "a field",
                        value = "some sort of value",
                        inline = true
                    }
                }
            };
            channel.CreateMessage(client, embed);
MadLad1Clip commented 5 years ago

Thank you very much.

Slut commented 5 years ago

No problem, feel free to close the issue if you believe this solved your issue.

MadLad1Clip commented 5 years ago

Yeah, i have not tested it yet so keeping it open in case I need some more support. I will try implement it later onto my system.

MadLad1Clip commented 5 years ago

Yeah, I am not able to work this out is there any chance you could help me out a bit more with this in a function? Sorry, I am not that good at C# still learning. Thank you.

MadLad1Clip commented 5 years ago

Ok so I made a little function to call it and I am getting this error. error CS0246: The type or namespace name `Field' could not be found. Are you missing an assembly reference?

   private void SendChannelEmbededMessage(string channel, string MSG)
    {
        IsClientConnected();
        Embed embed = new Embed
        {
            title = "hey",
            fields = new List<Field>
            {
                new Field
                {
                    name = "a field",
                    value = MSG,
                    inline = true
                }
            }
        };
        Channel.CreateMessage(Client, embed);
    }
Slut commented 5 years ago

Please use Embed.Field instead of Field in my instance I referenced field as a static class.

MadLad1Clip commented 5 years ago

That was it thank you very much I now have this working.