32 lines
826 B
Go
32 lines
826 B
Go
|
package wizard
|
||
|
|
||
|
import (
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/fsm"
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/handler/iface"
|
||
|
"github.com/mymmrac/telego"
|
||
|
tu "github.com/mymmrac/telego/telegoutil"
|
||
|
)
|
||
|
|
||
|
type HelpState struct {
|
||
|
State
|
||
|
}
|
||
|
|
||
|
func NewHelpState(app iface.App) fsm.IState[Wizard] {
|
||
|
return &HelpState{newBase(app)}
|
||
|
}
|
||
|
|
||
|
func (s *HelpState) Enter(pl *Wizard, _ fsm.MachineControls[*Wizard]) error {
|
||
|
_, err := s.App.TG().SendMessage(&telego.SendMessageParams{
|
||
|
ChatID: tu.ID(pl.Data.Message.Chat.ID),
|
||
|
Text: s.Localizer(pl.Data.Message.From.LanguageCode).
|
||
|
Template("help_output", map[string]interface{}{"Name": s.App.TGProfile().Username}),
|
||
|
ParseMode: telego.ModeMarkdown,
|
||
|
})
|
||
|
s.LogError(err)
|
||
|
return fsm.ErrPreventTransition
|
||
|
}
|
||
|
|
||
|
func (s *HelpState) ID() fsm.StateID {
|
||
|
return "help"
|
||
|
}
|