33 lines
910 B
Go
33 lines
910 B
Go
|
package fsmwizard
|
||
|
|
||
|
import (
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/handler/iface"
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/pkg/fsm"
|
||
|
"github.com/mymmrac/telego"
|
||
|
tu "github.com/mymmrac/telego/telegoutil"
|
||
|
)
|
||
|
|
||
|
const UnknownCommandStateID fsm.StateID = "unknown_command"
|
||
|
|
||
|
type UnknownCommandState struct {
|
||
|
State
|
||
|
}
|
||
|
|
||
|
func NewUnknownCommandState(app iface.App) fsm.IState[Wizard] {
|
||
|
return &UnknownCommandState{newBase(app)}
|
||
|
}
|
||
|
|
||
|
func (s *UnknownCommandState) Enter(pl *Wizard, _ fsm.MachineControls[Wizard]) error {
|
||
|
_, err := s.App.TG().SendMessage(&telego.SendMessageParams{
|
||
|
ChatID: tu.ID(s.Payload.Data.Message.Chat.ID),
|
||
|
Text: s.Localizer(s.Payload.Data.Message.From.LanguageCode).Message("unknown_command"),
|
||
|
ParseMode: telego.ModeMarkdown,
|
||
|
})
|
||
|
s.LogError(err)
|
||
|
return fsm.ErrPreventTransition
|
||
|
}
|
||
|
|
||
|
func (s *UnknownCommandState) ID() fsm.StateID {
|
||
|
return UnknownCommandStateID
|
||
|
}
|