kotlin+discord: compare command names after forcing lowercase #8

Manually merged
hamza merged 1 commits from hamza/TerraOceanPlugin:master into master 2019-10-12 11:28:04 +07:00
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()
} }
} }
} }