diff options
| author | Castor Regex <[email protected]> | 2025-08-24 13:23:12 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-24 13:23:12 -0500 |
| commit | a9b7fca08d612799b976c4ca80716e575546e1c4 (patch) | |
| tree | 24ed561c0838b25beeb630899a783159ed7af867 /doGetNextAutoTopic.go | |
| parent | 82eba977cdfc2c8e9d82655d0e7045337f7f2a15 (diff) | |
feat(chat): add --get-next-auto-topic flag
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) +} |
