Allow for case-insensitive HasStringPrefix (#644)

This was 👍'd in the dev chat, I forgot to make a PR for it (whoops!)
This commit is contained in:
Finite Reality
2017-05-06 06:39:46 +01:00
committed by RogueException
parent 82a413ace6
commit 112a434424

View File

@@ -1,4 +1,6 @@
namespace Discord.Commands using System;
namespace Discord.Commands
{ {
public static class MessageExtensions public static class MessageExtensions
{ {
@@ -12,10 +14,10 @@
} }
return false; return false;
} }
public static bool HasStringPrefix(this IUserMessage msg, string str, ref int argPos) public static bool HasStringPrefix(this IUserMessage msg, string str, ref int argPos, StringComparison comparisonType = StringComparison.Ordinal)
{ {
var text = msg.Content; var text = msg.Content;
if (text.StartsWith(str)) if (text.StartsWith(str, comparisonType))
{ {
argPos = str.Length; argPos = str.Length;
return true; return true;