From 2844a1c33e1bab100b98608afa27f602ef9d58d1 Mon Sep 17 00:00:00 2001 From: Pk-web6936 <202365630+Pk-web6936@users.noreply.github.com> Date: Sun, 30 Mar 2025 19:16:56 +0330 Subject: [PATCH] Update tgbot.go --- web/service/tgbot.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/web/service/tgbot.go b/web/service/tgbot.go index a3dd805f..24efb301 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -468,4 +468,21 @@ func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin boo } if msg != "" { - t.sendResponse(chatId + t.sendResponse(chatId, msg, onlyMessage, isAdmin) + } +} + +// Helper function to send the message based on onlyMessage flag. +func (t *Tgbot) sendResponse(chatId int64, msg string, onlyMessage, isAdmin bool) { + if onlyMessage { + t.SendMsgToTgbot(chatId, msg) + } else { + t.SendAnswer(chatId, msg, isAdmin) + } +} + +func (t *Tgbot) randomLowerAndNum(length int) string { + charset := "abcdefghijklmnopqrstuvwxyz0123456789" + bytes := make([]byte, length) + for i := range bytes { + randomIndex