From d237ed95e30e58b8189a559ded6bf8f5b814f49a Mon Sep 17 00:00:00 2001 From: Ricardo Balk <14904229+ricardobalk@users.noreply.github.com> Date: Sun, 12 Apr 2020 15:35:32 +0200 Subject: [PATCH] Updated /dev command --- cmdDev.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmdDev.go diff --git a/cmdDev.go b/cmdDev.go new file mode 100644 index 0000000..bfdc426 --- /dev/null +++ b/cmdDev.go @@ -0,0 +1,33 @@ +// +build !rm_basic_commands allcommands devcmd + +package main + +import ( + "fmt" + "strings" +) + +func init() { + command := Command{ + Cmd: []string{"dev"}, + Description: "- Switch to dev channels", + Help: "", + Exec: cmdDev, + } + + RegisterCommand(command) +} + +func cmdDev(cmd []string) { + dev = !dev + + printInfo(fmt.Sprintf("You have toggled the dev flag to %+v", dev)) + + if (lastChat != "") { + // Switching from regular to dev mode? Dev chats don't use channels. Let's strip the channel name. + n := "" + if (dev) { n = strings.Split(lastChat, "#")[0] } else { n = lastChat } + cmdJoin([]string{"/join", n}) + } + go updateChatWindow() // Otherwise you won't be able to process incoming messages. +}