I found an answer on how to do it without tons of repetition.you can do it like this:
val str = "!settings change something"val args = str.split(" ")when (args[0]) {"!settings" -> TODO()"!other" -> TODO()}
By doing it like this you don't have that much repetition because when having hundreds of cases you don't want to repeat writing msg.startsWith