| @@ -51,8 +51,7 @@ namespace Discord.Commands | |||||
| if (endPos == -1) return false; | if (endPos == -1) return false; | ||||
| if (text.Length < endPos + 2 || text[endPos + 1] != ' ') return false; //Must end in "> " | if (text.Length < endPos + 2 || text[endPos + 1] != ' ') return false; //Must end in "> " | ||||
| ulong userId; | |||||
| if (!MentionUtils.TryParseUser(text.Substring(0, endPos + 1), out userId)) return false; | |||||
| if (!MentionUtils.TryParseUser(text.Substring(0, endPos + 1), out ulong userId)) return false; | |||||
| if (userId == user.Id) | if (userId == user.Id) | ||||
| { | { | ||||
| argPos = endPos + 2; | argPos = endPos + 2; | ||||
| @@ -60,8 +60,7 @@ namespace Discord.Webhook | |||||
| /// <exception cref="ArgumentNullException">Thrown if the <paramref name="webhookUrl"/> is null or whitespace.</exception> | /// <exception cref="ArgumentNullException">Thrown if the <paramref name="webhookUrl"/> is null or whitespace.</exception> | ||||
| public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config) | public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config) | ||||
| { | { | ||||
| string token; | |||||
| ParseWebhookUrl(webhookUrl, out _webhookId, out token); | |||||
| ParseWebhookUrl(webhookUrl, out _webhookId, out string token); | |||||
| ApiClient.LoginAsync(TokenType.Webhook, token).GetAwaiter().GetResult(); | ApiClient.LoginAsync(TokenType.Webhook, token).GetAwaiter().GetResult(); | ||||
| Webhook = WebhookClientHelper.GetWebhookAsync(this, _webhookId).GetAwaiter().GetResult(); | Webhook = WebhookClientHelper.GetWebhookAsync(this, _webhookId).GetAwaiter().GetResult(); | ||||
| } | } | ||||
| @@ -47,9 +47,7 @@ namespace Discord | |||||
| var parsed = MentionUtils.ParseUser(user); | var parsed = MentionUtils.ParseUser(user); | ||||
| Assert.Equal(id, parsed); | Assert.Equal(id, parsed); | ||||
| // also check tryparse | |||||
| ulong result; | |||||
| Assert.True(MentionUtils.TryParseUser(user, out result)); | |||||
| Assert.True(MentionUtils.TryParseUser(user, out ulong result)); | |||||
| Assert.Equal(id, result); | Assert.Equal(id, result); | ||||
| } | } | ||||
| [Theory] | [Theory] | ||||
| @@ -75,9 +73,7 @@ namespace Discord | |||||
| var parsed = MentionUtils.ParseChannel(channel); | var parsed = MentionUtils.ParseChannel(channel); | ||||
| Assert.Equal(id, parsed); | Assert.Equal(id, parsed); | ||||
| // also check tryparse | |||||
| ulong result; | |||||
| Assert.True(MentionUtils.TryParseChannel(channel, out result)); | |||||
| Assert.True(MentionUtils.TryParseChannel(channel, out ulong result)); | |||||
| Assert.Equal(id, result); | Assert.Equal(id, result); | ||||
| } | } | ||||
| [Theory] | [Theory] | ||||
| @@ -103,9 +99,7 @@ namespace Discord | |||||
| var parsed = MentionUtils.ParseRole(role); | var parsed = MentionUtils.ParseRole(role); | ||||
| Assert.Equal(id, parsed); | Assert.Equal(id, parsed); | ||||
| // also check tryparse | |||||
| ulong result; | |||||
| Assert.True(MentionUtils.TryParseRole(role, out result)); | |||||
| Assert.True(MentionUtils.TryParseRole(role, out ulong result)); | |||||
| Assert.Equal(id, result); | Assert.Equal(id, result); | ||||
| } | } | ||||
| [Theory] | [Theory] | ||||