Add boundcheck for command parts when executing a command. Fixes
@@ -1827,6 +1827,7 @@ func (window *Window) ExecuteCommand(input string) {
parts := commands.ParseCommand(input)
fmt.Fprintf(window.commandView, "[gray]$ %s\n", input)
+ if len(parts) > 0 {
command := window.FindCommand(parts[0])
if command != nil {
command.Execute(window.commandView, parts[1:])
@@ -1834,6 +1835,7 @@ func (window *Window) ExecuteCommand(input string) {
fmt.Fprintf(window.commandView, "[red]The command '%s' doesn't exist[white]\n", parts[0])
}
}
+}
func (window *Window) startEditingMessage(message *discordgo.Message) {
if message.Author.ID == window.session.State.User.ID {
