diff --git a/build.sh b/build.sh
index 32ffd0f..d89cac9 100644
--- a/build.sh
+++ b/build.sh
@@ -1,4 +1,4 @@
###!/usr/bin/env bash
HASH=$(git log -1 --pretty=%h)
-docker build -t bloaterbot:latest -t bloaterbot:$HASH .
\ No newline at end of file
+docker build -t bloaterbot:latest -t bloaterbot:$HASH --build-arg=COMMIT=$(git log -1 --pretty=%h) .
\ No newline at end of file
diff --git a/commands/commands.go b/commands/commands.go
index 2f37bb8..78b8611 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -3,6 +3,7 @@ package commands
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"log"
+ "os"
"strconv"
"strings"
"time"
@@ -31,6 +32,8 @@ func Commands(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
notify.Reminder(update, bot)
case "help":
help(update, bot)
+ case "info":
+ info(update, bot)
}
}
@@ -62,3 +65,26 @@ func help(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
botIO.SendMessage(message, bot)
}
+
+func info(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
+ me, _ := bot.GetMe()
+ commit := os.Getenv("COMMIT")
+ if commit == "" {
+ commit = "not available"
+ }
+ info, _ := os.Stat("./bloater.db")
+ dbSizeInKiloBytes := info.Size() / 1000
+
+ textInfo := "" + me.FirstName + "" + "\n\n" +
+ "Commit: " + "" + commit + "
" + "\n" +
+ "DB Size: " + "" + strconv.FormatInt(dbSizeInKiloBytes, 10) + "KB" + "
"
+
+ message := tgbotapi.MessageConfig{
+ BaseChat: tgbotapi.BaseChat{ChatID: update.Message.Chat.ID, ReplyToMessageID: update.Message.MessageID},
+ ParseMode: "html",
+ DisableWebPagePreview: false,
+ Text: textInfo,
+ }
+ botIO.SendMessage(message, bot)
+
+}