Can now accept location

This commit is contained in:
2026-03-08 15:38:28 +08:00
parent 912f9fd0ad
commit 33a7c04e09
12 changed files with 286 additions and 148 deletions

View File

@@ -1,6 +1,7 @@
package tg
import (
"fmt"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
query "github.com/tgckpg/golifehk/query"
)
@@ -32,25 +33,37 @@ func BotSend(bot *tgbotapi.BotAPI, update *tgbotapi.Update, qResult query.IQuery
return false, nil
}
msg = tgbotapi.NewMessage(update.Message.Chat.ID, mesg)
var chatId int64
if update.Message != nil {
chatId = update.Message.Chat.ID
msg.ReplyToMessageID = update.Message.MessageID
}
if update.CallbackQuery != nil {
chatId = update.CallbackQuery.Message.Chat.ID
}
msg = tgbotapi.NewMessage(chatId, mesg)
msg.ParseMode = "MarkdownV2"
switch mesgType {
case "PlainText":
case "Table":
button := tgbotapi.NewInlineKeyboardButtonData(
"Show Status", // what user sees
"status_cmd", // what bot receives
)
msg.ReplyMarkup = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(button, button),
)
buttonRows := [][]tgbotapi.InlineKeyboardButton{}
for _, row := range qResult.GetTableData() {
buttons := []tgbotapi.InlineKeyboardButton{}
for _, cell := range row {
button := tgbotapi.NewInlineKeyboardButtonData(cell.Name, cell.Value)
buttons = append(buttons, button)
fmt.Println(cell)
}
buttonRows = append(buttonRows, buttons)
}
msg.ReplyMarkup = tgbotapi.NewInlineKeyboardMarkup(buttonRows...)
}
msg.ReplyToMessageID = update.Message.MessageID
bot.Send(msg)
return true, nil
}