group_helper/telegram/routines/command.go
2020-05-09 22:44:28 +02:00

23 lines
631 B
Go

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
}