Filtering for status command
This commit is contained in:
parent
732d173d0d
commit
e385a72841
|
@ -1,17 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
)
|
||||
|
||||
func getCurrentStatus(dataStore *DataStore, config AppConfig) string {
|
||||
// elements := FilterBasicElementsByTypeOrIndex(dataStore.GetBasicEventElements(), config.AllowedTypes, config.AllowedIndexes)
|
||||
return ""
|
||||
func getCurrentStatus(dataStore *DataStore, logger *log.Logger, config AppConfig, tpl *template.Template, s SatelNameGetter) string {
|
||||
elements := FilterBasicElementsByTypeOrIndex(dataStore.GetBasicEventElements(), config.AllowedTypes, config.AllowedIndexes)
|
||||
msg := GenericMessage{elements}
|
||||
return msg.Format(tpl, s, logger)
|
||||
}
|
||||
|
||||
func HandleTelegramCommands(bot tgbotapi.BotAPI, logger *log.Logger, dataStore *DataStore, config AppConfig) {
|
||||
func HandleTelegramCommands(bot tgbotapi.BotAPI, logger *log.Logger, dataStore *DataStore, config AppConfig, tpl *template.Template, s SatelNameGetter) {
|
||||
u := tgbotapi.NewUpdate(0)
|
||||
u.Timeout = 60
|
||||
|
||||
|
@ -33,7 +35,7 @@ func HandleTelegramCommands(bot tgbotapi.BotAPI, logger *log.Logger, dataStore *
|
|||
// Extract the command from the Message.
|
||||
switch update.Message.Command() {
|
||||
case "status":
|
||||
msg.Text = getCurrentStatus(dataStore, config)
|
||||
msg.Text = getCurrentStatus(dataStore, logger, config, tpl, s)
|
||||
}
|
||||
|
||||
if _, err := bot.Send(msg); err != nil {
|
||||
|
|
Loading…
Reference in New Issue