You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
395 B
23 lines
395 B
3 years ago
|
package userbot
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/rs/zerolog/log"
|
||
|
"math/rand"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func EatTask(b *Userbot) func() {
|
||
|
return func() {
|
||
|
rand.Seed(time.Now().UnixNano())
|
||
|
|
||
|
if b.Account.Eat && rand.Intn(100) <= b.Account.EatChance {
|
||
|
_, err := b.Sender.Resolve("@StartupWarsBot").Text(context.Background(), "/to_eat")
|
||
|
if err != nil {
|
||
|
log.Error().Err(err)
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|