update stat
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-03-14 01:49:54 +07:00
parent 01e132628c
commit 87157b2081
2 changed files with 13 additions and 6 deletions
+4 -4
View File
@@ -128,7 +128,7 @@ func run() {
return
}
for _, chatID := range chats {
if err := sendStatToChat(bot, dataBase, chatID, "Напоминаю:\n- Cегодня больше не жрем!\n\n"); err != nil {
if err := sendStatToChat(bot, dataBase, chatID, "Напоминаю:\n- Cегодня больше не жрем!\n\n", true); err != nil {
fmt.Println(err)
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
@@ -236,7 +236,7 @@ func run() {
case commands.Go:
sendGoToChat(bot, dataBase, chatID)
case commands.Stat:
if err := sendStatToChat(bot, dataBase, chatID, ""); err != nil {
if err := sendStatToChat(bot, dataBase, chatID, "", false); err != nil {
fmt.Println(err)
continue
}
@@ -288,8 +288,8 @@ func sendGoToChat(bot *tgbot.BotAPI, dataBase *db.DB, chatID int64) {
}
}
func sendStatToChat(bot *tgbot.BotAPI, dataBase *db.DB, chatID int64, prefix string) error {
stat, err := dataBase.GetStat(chatID)
func sendStatToChat(bot *tgbot.BotAPI, dataBase *db.DB, chatID int64, prefix string, cron bool) error {
stat, err := dataBase.GetStat(chatID, cron)
if err != nil {
return err
}