vegapokerbot/internal/handler/fsmwizard/help_state.go

34 lines
868 B
Go
Raw Normal View History

package fsmwizard
2024-05-13 16:57:55 +03:00
import (
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/handler/iface"
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/pkg/fsm"
2024-05-13 16:57:55 +03:00
"github.com/mymmrac/telego"
tu "github.com/mymmrac/telego/telegoutil"
)
2024-05-13 17:18:22 +03:00
const HelpStateID fsm.StateID = "help"
2024-05-13 16:57:55 +03:00
type HelpState struct {
State
}
func NewHelpState(app iface.App) fsm.IState[Wizard] {
return &HelpState{newBase(app)}
}
2024-05-14 14:44:41 +03:00
func (s *HelpState) Enter(pl *Wizard, _ fsm.MachineControls[Wizard]) error {
2024-05-13 16:57:55 +03:00
_, 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 {
2024-05-13 17:18:22 +03:00
return HelpStateID
2024-05-13 16:57:55 +03:00
}