Skip to main content

Class DiscordWebhookClient

A client responsible for connecting as a Webhook.

Assembly: Discord.Net.Webhook.dll​
View Source​
Declaration
public class DiscordWebhookClient : IDisposable

Methods​

SendMessageAsync(String, Boolean, IEnumerable<Embed>, String, String, RequestOptions, AllowedMentions, MessageComponent)​

Sends a message to the channel for this webhook.

View Source​
Declaration
public Task<ulong> SendMessageAsync(string text = null, bool isTTS = false, IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent component = null)
Returns​

System.Threading.Tasks.Task<System.UInt64>: Returns the ID of the created message.

Parameters​
TypeName
System.Stringtext
System.BooleanisTTS
System.Collections.Generic.IEnumerable<Discord.Embed>embeds
System.Stringusername
System.StringavatarUrl
Discord.RequestOptionsoptions
Discord.AllowedMentionsallowedMentions
Discord.MessageComponentcomponent

ModifyMessageAsync(UInt64, Action<WebhookMessageProperties>, RequestOptions)​

Modifies a message posted using this webhook.

View Source​
Declaration
public Task ModifyMessageAsync(ulong messageId, Action<WebhookMessageProperties> func, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous modification operation.

Parameters​
TypeNameDescription
System.UInt64messageIdID of the modified message.
System.Action<Discord.Webhook.WebhookMessageProperties>funcA delegate containing the properties to modify the message with.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

DeleteMessageAsync(UInt64, RequestOptions)​

Deletes a message posted using this webhook.

View Source​
Declaration
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous deletion operation.

Parameters​
TypeNameDescription
System.UInt64messageIdID of the deleted message.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

SendFileAsync(String, String, Boolean, IEnumerable<Embed>, String, String, RequestOptions, Boolean, AllowedMentions, MessageComponent)​

Sends a message to the channel for this webhook with an attachment.

View Source​
Declaration
public Task<ulong> SendFileAsync(string filePath, string text, bool isTTS = false, IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageComponent components = null)
Returns​

System.Threading.Tasks.Task<System.UInt64>: Returns the ID of the created message.

Parameters​
TypeName
System.StringfilePath
System.Stringtext
System.BooleanisTTS
System.Collections.Generic.IEnumerable<Discord.Embed>embeds
System.Stringusername
System.StringavatarUrl
Discord.RequestOptionsoptions
System.BooleanisSpoiler
Discord.AllowedMentionsallowedMentions
Discord.MessageComponentcomponents

SendFileAsync(Stream, String, String, Boolean, IEnumerable<Embed>, String, String, RequestOptions, Boolean, AllowedMentions, MessageComponent)​

Sends a message to the channel for this webhook with an attachment.

View Source​
Declaration
public Task<ulong> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageComponent components = null)
Returns​

System.Threading.Tasks.Task<System.UInt64>: Returns the ID of the created message.

Parameters​
TypeName
System.IO.Streamstream
System.Stringfilename
System.Stringtext
System.BooleanisTTS
System.Collections.Generic.IEnumerable<Discord.Embed>embeds
System.Stringusername
System.StringavatarUrl
Discord.RequestOptionsoptions
System.BooleanisSpoiler
Discord.AllowedMentionsallowedMentions
Discord.MessageComponentcomponents

SendFileAsync(FileAttachment, String, Boolean, IEnumerable<Embed>, String, String, RequestOptions, AllowedMentions, MessageComponent)​

Sends a message to the channel for this webhook with an attachment.

View Source​
Declaration
public Task<ulong> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false, IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null)
Returns​

System.Threading.Tasks.Task<System.UInt64>: Returns the ID of the created message.

Parameters​
TypeName
Discord.FileAttachmentattachment
System.Stringtext
System.BooleanisTTS
System.Collections.Generic.IEnumerable<Discord.Embed>embeds
System.Stringusername
System.StringavatarUrl
Discord.RequestOptionsoptions
Discord.AllowedMentionsallowedMentions
Discord.MessageComponentcomponents

SendFilesAsync(IEnumerable<FileAttachment>, String, Boolean, IEnumerable<Embed>, String, String, RequestOptions, AllowedMentions, MessageComponent)​

Sends a message to the channel for this webhook with an attachment.

View Source​
Declaration
public Task<ulong> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false, IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null)
Returns​

System.Threading.Tasks.Task<System.UInt64>: Returns the ID of the created message.

Parameters​
TypeName
System.Collections.Generic.IEnumerable<Discord.FileAttachment>attachments
System.Stringtext
System.BooleanisTTS
System.Collections.Generic.IEnumerable<Discord.Embed>embeds
System.Stringusername
System.StringavatarUrl
Discord.RequestOptionsoptions
Discord.AllowedMentionsallowedMentions
Discord.MessageComponentcomponents

ModifyWebhookAsync(Action<WebhookProperties>, RequestOptions)​

Modifies the properties of this webhook.

View Source​
Declaration
public Task ModifyWebhookAsync(Action<WebhookProperties> func, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
System.Action<Discord.WebhookProperties>func
Discord.RequestOptionsoptions

DeleteWebhookAsync(RequestOptions)​

Deletes this webhook from Discord and disposes the client.

View Source​
Declaration
public async Task DeleteWebhookAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
Discord.RequestOptionsoptions

Dispose()​

View Source​
Declaration
public void Dispose()

Events​

Log​

View Source​
Declaration
public event Func<LogMessage, Task> Log
Event Type​

System.Func<Discord.LogMessage,System.Threading.Tasks.Task>

Implements​

  • System.IDisposable