Browse Source

Fix: Using the correct discord domain.

pull/1571/head
BramEsendam 5 years ago
parent
commit
364885ee0a
2 changed files with 6 additions and 6 deletions
  1. +4
    -4
      samples/04_webhook_client/Program.cs
  2. +2
    -2
      test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs

+ 4
- 4
samples/04_webhook_client/Program.cs View File

@@ -14,10 +14,10 @@ namespace _04_webhook_client

public async Task MainAsync()
{
// The webhook url follows the format https://discordapp.com/api/webhooks/{id}/{token}
// The webhook url follows the format https://discord.com/api/webhooks/{id}/{token}
// Because anyone with the webhook URL can use your webhook
// you should NOT hard code the URL or ID + token into your application.
using (var client = new DiscordWebhookClient("https://discordapp.com/api/webhooks/123/abc123"))
// you should NOT hard code the URL or ID + token into your application.
using (var client = new DiscordWebhookClient("https://discord.com/api/webhooks/123/abc123"))
{
var embed = new EmbedBuilder
{
@@ -26,7 +26,7 @@ namespace _04_webhook_client
};

// Webhooks are able to send multiple embeds per message
// As such, your embeds must be passed as a collection.
// As such, your embeds must be passed as a collection.
await client.SendMessageAsync(text: "Send a message to this webhook!", embeds: new[] { embed.Build() });
}
}


+ 2
- 2
test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs View File

@@ -12,7 +12,7 @@ namespace Discord
public class DiscordWebhookClientTests
{
[Theory]
[InlineData("https://discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
[InlineData("https://discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// ptb, canary, etc will have slightly different urls
[InlineData("https://ptb.discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
@@ -48,7 +48,7 @@ namespace Discord
[Theory]
[InlineData("123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// trailing slash
[InlineData("https://discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK/")]
[InlineData("https://discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK/")]
public void TestWebhook_Invalid(string webhookurl)
{
Assert.Throws<ArgumentException>(() =>


Loading…
Cancel
Save