summaryrefslogtreecommitdiff
path: root/doGetNextAutoTopic.go
blob: 75060a73e98f81425d3961cf50de7fa6630aa09a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"strconv"
	"strings"

	"go.wit.com/log"
)

func doGetNextAutoTopic() {
	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)
}