Initial rewriting
Signed-off-by: Ettore Dreucci <ettore.dreucci@gmail.com>
This commit is contained in:
29
telegramAPI.go
Normal file
29
telegramAPI.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
tb "gopkg.in/tucnak/telebot.v2"
|
||||
)
|
||||
|
||||
func botInit() ([]*tb.Bot, []error) {
|
||||
var bots []*tb.Bot
|
||||
var errors []error
|
||||
for i, token := range tokens {
|
||||
var timeout int
|
||||
if i < len(timeouts) {
|
||||
timeout = timeouts[i]
|
||||
} else {
|
||||
timeout = 10
|
||||
}
|
||||
tmpBot, tmpErr := tb.NewBot(tb.Settings{
|
||||
Token: token,
|
||||
Poller: &tb.LongPoller{Timeout: time.Duration(timeout) * time.Second},
|
||||
})
|
||||
|
||||
bots = append(bots, tmpBot)
|
||||
errors = append(errors, tmpErr)
|
||||
}
|
||||
|
||||
return bots, errors
|
||||
}
|
Reference in New Issue
Block a user