summaryrefslogtreecommitdiff
path: root/getNextAutoTopic.go
blob: 70f4e133bd43d4348bbbef6769bf8828789b3fd2 (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 getNextAutoTopic() {
	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)
}