From a9b7fca08d612799b976c4ca80716e575546e1c4 Mon Sep 17 00:00:00 2001 From: Castor Regex Date: Sun, 24 Aug 2025 13:23:12 -0500 Subject: feat(chat): add --get-next-auto-topic flag --- doGetNextAutoTopic.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 doGetNextAutoTopic.go (limited to 'doGetNextAutoTopic.go') 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) +} -- cgit v1.2.3