DiscordChatProvider.

PostMessage(string, string, DiscordChatMessageSettings) Method

Summary

Post message to Discord WebHook.
Namespace
Cake.Discord.Chat
Containing Type
DiscordChatProvider

Syntax

[CakeAliasCategory("Chat")]
public DiscordChatMessageResult PostMessage(string webHookUrl, string content, DiscordChatMessageSettings messageSettings)

Examples

    Information("This is a custom avatar and name message...");

    var postMessageResult = Discord.Chat.PostMessage(
        webHookUrl:"https://your_web_hook_url",
        content:"This is a custom avatar and name message.",
        messageSettings:new DiscordChatMessageSettings {
            UserName = "gep13",
            AvatarUrl = new Uri("https://avatars0.githubusercontent.com/u/1271146?s=400%26v=4")
            }
        );

    if (postMessageResult.Ok)
    {
        Information("Message {0} successfully sent", postMessageResult.TimeStamp);
    }
    else
    {
        Error("Failed to send message: {0}", postMessageResult.Error);
    }

Attributes

Type Description
CakeAliasCategory

Parameters

Name Type Description
webHookUrl string The URL for the webhook that messages should be sent to.
content string Content of the message to send.
messageSettings DiscordChatMessageSettings Lets you override default settings like UserName, or IconUrl.

Return Value

Type Description
DiscordChatMessageResult Returns success/error/timestamp DiscordChatMessageResult.