From 13fa78987cd7ec819f7d5ed6ba51bd0a18219f26 Mon Sep 17 00:00:00 2001 From: spiral Date: Fri, 29 Oct 2021 13:04:41 -0400 Subject: [PATCH] fix: accept channel ID in MatchChannel --- PluralKit.Bot/Utils/MentionUtils.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/PluralKit.Bot/Utils/MentionUtils.cs b/PluralKit.Bot/Utils/MentionUtils.cs index 3ecb3c79..adb8c39e 100644 --- a/PluralKit.Bot/Utils/MentionUtils.cs +++ b/PluralKit.Bot/Utils/MentionUtils.cs @@ -83,13 +83,12 @@ namespace PluralKit.Bot.Utils /// public static bool TryParseChannel(string text, out ulong channelId) { - if (text.Length >= 3 && text[0] == '<' && text[1] == '#' && text[text.Length - 1] == '>') - { + if (text.Length > 3 && text[0] == '<' && text[1] == '#' && text[text.Length - 1] == '>') text = text.Substring(2, text.Length - 3); //<#123> - if (ulong.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out channelId)) - return true; - } + if (ulong.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out channelId)) + return true; + channelId = 0; return false; }