From f314c20dd8cfbeb43b46276081c090133c8dd43b Mon Sep 17 00:00:00 2001 From: kageru Date: Fri, 30 Aug 2019 15:27:11 +0200 Subject: [PATCH] Make command matching case-insensitive --- src/main/kotlin/moe/kageru/kagebot/command/Command.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/moe/kageru/kagebot/command/Command.kt b/src/main/kotlin/moe/kageru/kagebot/command/Command.kt index bd1a82a..efdef14 100644 --- a/src/main/kotlin/moe/kageru/kagebot/command/Command.kt +++ b/src/main/kotlin/moe/kageru/kagebot/command/Command.kt @@ -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)