kotlin+discord: compare command names after forcing lowercase

master
ALI Hamza 2019-10-12 18:21:19 +07:00
parent d1588fffcf
commit 60af28773a
No known key found for this signature in database
GPG Key ID: 7C608266BF384ADC
2 changed files with 3 additions and 3 deletions

@ -16,7 +16,7 @@ func ProcessCommand(s *discordgo.Session, m *discordgo.MessageCreate) {
command := strings.Split(m.Content, " ") command := strings.Split(m.Content, " ")
for _, v := range modules.Commands { for _, v := range modules.Commands {
if v.Name == command[0] { if v.Name == strings.toLower(command[0]) {
v.Handler(s, m, command) v.Handler(s, m, command)
return return
} }

@ -25,7 +25,7 @@ fun establishConnection() {
} }
fun processMessage(msg: List<String>) { fun processMessage(msg: List<String>) {
when (msg[0]) { when (msg[0].toLowerCase()) {
"leave" -> { "leave" -> {
Bukkit.getPlayer(msg[1])?.kickPlayer(Strings.kickVoiceChannel) Bukkit.getPlayer(msg[1])?.kickPlayer(Strings.kickVoiceChannel)
} }
@ -80,4 +80,4 @@ class WSListener : WebSocketListener() {
establishConnection() establishConnection()
} }
} }
} }