kill bot after 10 minutes idling

should prevent 'ping loss' due to weird network setup
This commit is contained in:
Eva Dengler 2022-03-05 21:39:54 +01:00
commit f6cf8b46ec
8 changed files with 187 additions and 230 deletions

45
helpers.go Normal file
View file

@ -0,0 +1,45 @@
package main
import (
"fmt"
)
func checkErr(err error) {
if err != nil {
fmt.Printf("::::ERROR:::: %s\n", err)
panic(err)
}
}
func in (a byte, arr []byte) bool {
for _, x := range arr {
if x == a {
return true
}
}
return false
}
func unique_str(stringSlice []string) []string {
keys := make(map[string]bool)
list := []string{}
for _, entry := range stringSlice {
if _, value := keys[entry]; !value {
keys[entry] = true
list = append(list, entry)
}
}
return list
}
func unique_int(intSlice []int) []int {
keys := make(map[int]bool)
list := []int{}
for _, entry := range intSlice {
if _, value := keys[entry]; !value {
keys[entry] = true
list = append(list, entry)
}
}
return list
}