From 60af28773a82a2b12792233d5d8e066d56901389 Mon Sep 17 00:00:00 2001 From: Hamza Ali Date: Sat, 12 Oct 2019 18:21:19 +0700 Subject: [PATCH] kotlin+discord: compare command names after forcing lowercase --- GoBot/discord/listener.go | 2 +- .../src/main/kotlin/com/terraocean/plugin/bridge/WebSocket.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GoBot/discord/listener.go b/GoBot/discord/listener.go index 63fcde1..2fc868f 100644 --- a/GoBot/discord/listener.go +++ b/GoBot/discord/listener.go @@ -16,7 +16,7 @@ func ProcessCommand(s *discordgo.Session, m *discordgo.MessageCreate) { command := strings.Split(m.Content, " ") for _, v := range modules.Commands { - if v.Name == command[0] { + if v.Name == strings.toLower(command[0]) { v.Handler(s, m, command) return } diff --git a/KotlinPlugin/src/main/kotlin/com/terraocean/plugin/bridge/WebSocket.kt b/KotlinPlugin/src/main/kotlin/com/terraocean/plugin/bridge/WebSocket.kt index 278996f..ff4ec96 100644 --- a/KotlinPlugin/src/main/kotlin/com/terraocean/plugin/bridge/WebSocket.kt +++ b/KotlinPlugin/src/main/kotlin/com/terraocean/plugin/bridge/WebSocket.kt @@ -25,7 +25,7 @@ fun establishConnection() { } fun processMessage(msg: List) { - when (msg[0]) { + when (msg[0].toLowerCase()) { "leave" -> { Bukkit.getPlayer(msg[1])?.kickPlayer(Strings.kickVoiceChannel) } @@ -80,4 +80,4 @@ class WSListener : WebSocketListener() { establishConnection() } } -} \ No newline at end of file +}