/// <summary> /// Creates a new Webhook Discord client. /// </summary> /// <param name="webhookUrl">The url of the webhook.</param> /// <param name="config">The configuration options to use for this client.</param> /// <exception cref="ArgumentException">Thrown if the <paramref name="webhookUrl"/> is an invalid format.</exception> /// <exception cref="ArgumentNullException">Thrown if the <paramref name="webhookUrl"/> is null or whitespace.</exception> public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config) { string token; ParseWebhookUrl(webhookUrl, out _webhookId, out token); ApiClient.LoginAsync(TokenType.Webhook, token).GetAwaiter().GetResult(); Webhook = WebhookClientHelper.GetWebhookAsync(this, _webhookId).GetAwaiter().GetResult(); }
/// <summary> Creates a new Webhook Discord client. </summary> public DiscordWebhookClient(ulong webhookId, string webhookToken, DiscordRestConfig config) : this(config) { _webhookId = webhookId; ApiClient.LoginAsync(TokenType.Webhook, webhookToken).GetAwaiter().GetResult(); Webhook = WebhookClientHelper.GetWebhookAsync(this, webhookId).GetAwaiter().GetResult(); }