Can now accept location
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user