Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/WebhookClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public static async Task Main()

// Webhooks are able to send multiple embeds per message
// As such, your embeds must be passed as a collection.
await client.SendMessageAsync(text: "Send a message to this webhook!", embeds: new[] { embed.Build() });
await client.SendMessageAsync(text: "Send a message to this webhook!", embed: embed.Build() );
}
}
4 changes: 2 additions & 2 deletions src/Discord.Net.Webhook/DiscordWebhookClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ private static API.DiscordRestApiClient CreateApiClient(DiscordRestConfig config
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 components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null,
ulong[] appliedTags = null)
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components, flags, threadId, threadName, appliedTags);
ulong[] appliedTags = null, Embed embed = null)
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components, flags, threadId, threadName, appliedTags, embed);

/// <summary>
/// Modifies a message posted using this webhook.
Expand Down
7 changes: 6 additions & 1 deletion src/Discord.Net.Webhook/WebhookClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public static async Task<RestInternalWebhook> GetWebhookAsync(DiscordWebhookClie
public static async Task<ulong> SendMessageAsync(DiscordWebhookClient client,
string text, bool isTTS, IEnumerable<Embed> embeds, string username, string avatarUrl,
AllowedMentions allowedMentions, RequestOptions options, MessageComponent components,
MessageFlags flags, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null)
MessageFlags flags, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null,
Embed embed = null)
{
embeds ??= Array.Empty<Embed>();
if (embed != null)
embeds = new[] { embed }.Concat(embeds).ToArray();

var args = new CreateWebhookMessageParams
{
Content = text,
Expand Down