diff options
Diffstat (limited to 'doGetNextAutoTopic.go')
| -rw-r--r-- | doGetNextAutoTopic.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doGetNextAutoTopic.go b/doGetNextAutoTopic.go new file mode 100644 index 0000000..47fb524 --- /dev/null +++ b/doGetNextAutoTopic.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "strconv" + "strings" +) + +func doGetNextAutoTopic() { + if err := me.chats.ConfigLoad(); err != nil { + badExit(err) + } + max := 0 + for _, chat := range me.chats.GetChats() { + if strings.HasPrefix(chat.GetChatName(), "Auto ") { + numStr := strings.TrimPrefix(chat.GetChatName(), "Auto ") + num, err := strconv.Atoi(numStr) + if err == nil && num > max { + max = num + } + } + } + fmt.Printf("Auto %d", max+1) +} |
