bloaterbot/commands/commands.go
2023-03-19 22:46:00 +01:00

43 lines
983 B
Go

package commands
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"log"
"strconv"
"strings"
"time"
"watn3y/bloaterbotv3/botIO"
"watn3y/bloaterbotv3/commands/gaypoints"
"watn3y/bloaterbotv3/commands/notify"
"watn3y/bloaterbotv3/config"
)
func Commands(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
cmd := strings.ToLower(update.Message.Command())
switch cmd {
case "shutup":
shutup(update, bot)
case "shut":
shutup(update, bot)
case "gp":
gaypoints.GetGP(update, bot)
case "addgp":
gaypoints.SetGP(update, bot)
case "subtractgp":
gaypoints.SetGP(update, bot)
case "remindme":
notify.Reminder(update, bot)
}
}
func shutup(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
config.BotConfig.Shutup[update.Message.Chat.ID] = time.Now().UTC()
msg := tgbotapi.NewMessage(update.Message.Chat.ID, "Shutting up")
log.Println("Shutting up for Chat: " + strconv.FormatInt(update.Message.Chat.ID, 10))
botIO.SendMessage(msg, bot)
}