DiscordChatProvider.

PostMessage(string, string) Method

Summary

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

Syntax

public DiscordChatMessageResult PostMessage(string webHookUrl, string content)

Examples

     Information("This is a 'normal' message...");

     var postMessageResult = Discord.Chat.PostMessage(
        webHookUrl:"https://your_web_hook_url",
        content:"This is a normal message."
     );

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

Attributes

Type Description
CakeAliasCategoryAttribute

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.

Return Value

Type Description
DiscordChatMessageResult Returns success/errorcode/error/timestamp DiscordChatMessageResult