Browse Source

Allow for case-insensitive HasStringPrefix (#644)

This was 👍'd in the dev chat, I forgot to make a PR for it (whoops!)
tags/1.0.0-rc2
Finite Reality RogueException 8 years ago
parent
commit
112a434424
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/Discord.Net.Commands/Extensions/MessageExtensions.cs

+ 5
- 3
src/Discord.Net.Commands/Extensions/MessageExtensions.cs 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;


Loading…
Cancel
Save