feature: Add webhook url overload for DiscordWebhookClient (#1260)

* Add webhook url overload for DiscordWebhookClient

Adds an overloaded constructor for `DiscordWebhookClient` which accepts the webhook URL. This URL is parsed using a regex for the id and token. If the token is invalid an `ArgumentException` is thrown.

* add null or whitespace check

* add some tests for the new DiscordWebhookClient constructor

* make the Regex static, specify flags

* update regex to look for "discordapp"

* specify reason why exception is thrown despite regex match

* move parsing logic into new function for testing
This commit is contained in:
Chris Johnston
2019-05-04 14:14:32 -07:00
committed by Christopher F
parent 1ae42207f8
commit f2113c7c2b
3 changed files with 109 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
<ProjectReference Include="../../src/Discord.Net.Core/Discord.Net.Core.csproj" />
<ProjectReference Include="../../src/Discord.Net.Rest/Discord.Net.Rest.csproj" />
<ProjectReference Include="../../src/Discord.Net.Analyzers/Discord.Net.Analyzers.csproj" />
<ProjectReference Include="..\..\src\Discord.Net.Webhook\Discord.Net.Webhook.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Akavache" Version="6.0.31" />