blob: 647d209c136097e0e4bce4ac2aab189a10b6c6f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package main
import (
"strconv"
"strings"
"go.wit.com/log"
)
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
}
}
}
log.Printf("Auto %d", max+1)
}
|