Make command matching case-insensitive

This commit is contained in:
kageru 2019-08-30 15:27:11 +02:00
parent f871d2a381
commit f314c20dd8
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -69,10 +69,10 @@ class Command(cmd: RawCommand) {
enum class MatchType {
PREFIX {
override fun matches(message: String, command: Command) = message.startsWith(command.trigger)
override fun matches(message: String, command: Command) = message.startsWith(command.trigger, ignoreCase = true)
},
CONTAINS {
override fun matches(message: String, command: Command) = message.contains(command.trigger)
override fun matches(message: String, command: Command) = message.contains(command.trigger, ignoreCase = true)
},
REGEX {
override fun matches(message: String, command: Command) = command.regex!!.matches(message)