group_helper/telegram/routines/command.go

23 lines
631 B
Go
Raw Normal View History

package routines
import (
"git.dragon-labs.de/alphyron/group_helper/cli"
"git.dragon-labs.de/alphyron/group_helper/models"
"git.dragon-labs.de/alphyron/group_helper/telegram"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
type commandRoutine struct {
CommandManager *cli.CommandManager
}
func NewCommandRoutine(commandManager *cli.CommandManager) telegram.Routine {
return &commandRoutine{CommandManager: commandManager}
}
func (cr commandRoutine) Update(botAPI *tgbotapi.BotAPI, update *tgbotapi.Update, group *models.Group) error {
_, err := cr.CommandManager.ExecuteUpdate(update, group)
return err
}