fix: accept channel ID in MatchChannel
This commit is contained in:
parent
456545efe8
commit
13fa78987c
@ -83,13 +83,12 @@ namespace PluralKit.Bot.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool TryParseChannel(string text, out ulong channelId)
|
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>
|
text = text.Substring(2, text.Length - 3); //<#123>
|
||||||
|
|
||||||
if (ulong.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out channelId))
|
if (ulong.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out channelId))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
channelId = 0;
|
channelId = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user