Class DiscordWebhookClient
A client responsible for connecting as a Webhook.
Assembly: Discord.Net.Webhook.dll​
View Source​
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​
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​
Type | Name |
---|---|
System.String | text |
System.Boolean | isTTS |
System.Collections.Generic.IEnumerable<Discord.Embed> | embeds |
System.String | username |
System.String | avatarUrl |
Discord.RequestOptions | options |
Discord.AllowedMentions | allowedMentions |
Discord.MessageComponent | component |
ModifyMessageAsync(UInt64, Action<WebhookMessageProperties>, RequestOptions)​
Modifies a message posted using this webhook.
View Source​
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​
Type | Name | Description |
---|---|---|
System.UInt64 | messageId | ID of the modified message. |
System.Action<Discord.Webhook.WebhookMessageProperties> | func | A delegate containing the properties to modify the message with. |
Discord.RequestOptions | options | The options to be used when sending the request. |
DeleteMessageAsync(UInt64, RequestOptions)​
Deletes a message posted using this webhook.
View Source​
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous deletion operation.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | messageId | ID of the deleted message. |
Discord.RequestOptions | options | The 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​
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​
Type | Name |
---|---|
System.String | filePath |
System.String | text |
System.Boolean | isTTS |
System.Collections.Generic.IEnumerable<Discord.Embed> | embeds |
System.String | username |
System.String | avatarUrl |
Discord.RequestOptions | options |
System.Boolean | isSpoiler |
Discord.AllowedMentions | allowedMentions |
Discord.MessageComponent | components |
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​
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​
Type | Name |
---|---|
System.IO.Stream | stream |
System.String | filename |
System.String | text |
System.Boolean | isTTS |
System.Collections.Generic.IEnumerable<Discord.Embed> | embeds |
System.String | username |
System.String | avatarUrl |
Discord.RequestOptions | options |
System.Boolean | isSpoiler |
Discord.AllowedMentions | allowedMentions |
Discord.MessageComponent | components |
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​
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​
Type | Name |
---|---|
Discord.FileAttachment | attachment |
System.String | text |
System.Boolean | isTTS |
System.Collections.Generic.IEnumerable<Discord.Embed> | embeds |
System.String | username |
System.String | avatarUrl |
Discord.RequestOptions | options |
Discord.AllowedMentions | allowedMentions |
Discord.MessageComponent | components |
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​
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​
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<Discord.FileAttachment> | attachments |
System.String | text |
System.Boolean | isTTS |
System.Collections.Generic.IEnumerable<Discord.Embed> | embeds |
System.String | username |
System.String | avatarUrl |
Discord.RequestOptions | options |
Discord.AllowedMentions | allowedMentions |
Discord.MessageComponent | components |
ModifyWebhookAsync(Action<WebhookProperties>, RequestOptions)​
Modifies the properties of this webhook.
View Source​
public Task ModifyWebhookAsync(Action<WebhookProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name |
---|---|
System.Action<Discord.WebhookProperties> | func |
Discord.RequestOptions | options |
DeleteWebhookAsync(RequestOptions)​
Deletes this webhook from Discord and disposes the client.
View Source​
public async Task DeleteWebhookAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name |
---|---|
Discord.RequestOptions | options |
Dispose()​
View Source​
public void Dispose()
Events​
Log​
View Source​
public event Func<LogMessage, Task> Log
Event Type​
System.Func<Discord.LogMessage,System.Threading.Tasks.Task>
Implements​
System.IDisposable