action

package
v0.0.0-...-5f2f827 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ConfirmDeleteSub = "+"
View Source
const ToggleDisableInput = "+"
View Source
const ToggleSetSource = "+"

Variables

This section is empty.

Functions

func LocationToHTMLString

func LocationToHTMLString(loc *entity.Location) string

func ResetAwaitInput

func ResetAwaitInput(resetInput ResetInputType, chatID int64, s storage.Service) error

func ShowCreateSubscription

func ShowCreateSubscription(chatID int64, bot *tgbotapi.BotAPI)

func ShowHome

func ShowHome(bot *tgbotapi.BotAPI, chatID int64)

func ShowSetDelay

func ShowSetDelay(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSetLocation

func ShowSetLocation(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSetMagnitude

func ShowSetMagnitude(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSetName

func ShowSetName(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSetRadius

func ShowSetRadius(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSubscription

func ShowSubscription(chatID int64, subID string, bot *tgbotapi.BotAPI, s storage.Service)

func ShowSubscriptions

func ShowSubscriptions(chatID int64, bot *tgbotapi.BotAPI, s storage.Service)

func ShowUnknownCommand

func ShowUnknownCommand(bot *tgbotapi.BotAPI, chatID int64)

func UnknownCommandText

func UnknownCommandText() string

Types

type Action

type Action struct {
	Cmd    Cmd
	Params Params
}

func (Action) Encode

func (a Action) Encode() string

func (Action) ProcessUserInput

func (a Action) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (Action) ToAction

func (a Action) ToAction() Action

type Actionable

type Actionable interface {
	Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)
	ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)
}

func Decode

func Decode(data string) (Actionable, error)

func New

func New(data string) (Actionable, error)

type Cmd

type Cmd string
const CreateSub Cmd = "CREATE_SUB"
const DeleteSub Cmd = "DELETE_SUB"
const DisableInput Cmd = "DISABLE_INPUT"
const Home Cmd = "HOME"
const ListSources Cmd = "LIST_SRCS"
const SetDelay Cmd = "SET_DELAY"
const SetLocation Cmd = "SET_LOCATION"
const SetMagnitude Cmd = "SET_MAG"
const SetName Cmd = "SET_NAME"
const SetRadius Cmd = "SET_RADIUS"
const SetSource Cmd = "SET_SOURCE"
const Settings Cmd = "SETTINGS"
const Sub Cmd = "SUB"
const Subs Cmd = "SUBS"

type CreateSubscriptionAction

type CreateSubscriptionAction struct {
	Action
}

func NewCreateSubscriptionAction

func NewCreateSubscriptionAction() CreateSubscriptionAction

func (CreateSubscriptionAction) Perform

func (CreateSubscriptionAction) ProcessUserInput

func (a CreateSubscriptionAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (CreateSubscriptionAction) WrongInput

func (a CreateSubscriptionAction) WrongInput() string

type DeleteSubscriptionAction

type DeleteSubscriptionAction struct {
	Action
}

func NewDeleteSubscriptionAction

func NewDeleteSubscriptionAction(subID, confirm string) DeleteSubscriptionAction

func (DeleteSubscriptionAction) Perform

type DisableInputAction

type DisableInputAction struct {
	Action
}

func NewDisableInputAction

func NewDisableInputAction(confirm string) DisableInputAction

func (DisableInputAction) Perform

type HomeAction

type HomeAction struct {
	Action
}

func NewHomeAction

func NewHomeAction() HomeAction

func (HomeAction) Perform

func (a HomeAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

type ListSourcesAction

type ListSourcesAction struct {
	Action
}

func NewListSourcesAction

func NewListSourcesAction(subID string) ListSourcesAction

func (ListSourcesAction) Perform

func (a ListSourcesAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

type Params

type Params struct {
	P1 string
	P2 string
	P3 string
}

type ResetInputType

type ResetInputType string
const ResetInput ResetInputType = "+"

type SetDelayAction

type SetDelayAction struct {
	Action
}

func NewSetDelayAction

func NewSetDelayAction(subID string) SetDelayAction

func (SetDelayAction) Perform

func (a SetDelayAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

func (SetDelayAction) ProcessUserInput

func (a SetDelayAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (SetDelayAction) WrongInput

func (a SetDelayAction) WrongInput() string

type SetLocationAction

type SetLocationAction struct {
	Action
}

func NewSetLocationAction

func NewSetLocationAction(subID string) SetLocationAction

func (SetLocationAction) Perform

func (a SetLocationAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

func (SetLocationAction) ProcessUserInput

func (a SetLocationAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (SetLocationAction) WrongInput

func (a SetLocationAction) WrongInput() string

type SetMagnitudeAction

type SetMagnitudeAction struct {
	Action
}

func NewSetMagnitudeAction

func NewSetMagnitudeAction(subID string) SetMagnitudeAction

func (SetMagnitudeAction) Perform

func (SetMagnitudeAction) ProcessUserInput

func (a SetMagnitudeAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (SetMagnitudeAction) WrongInput

func (a SetMagnitudeAction) WrongInput() string

type SetNameAction

type SetNameAction struct {
	Action
}

func NewSetNameAction

func NewSetNameAction(subID string) SetNameAction

func (SetNameAction) Perform

func (a SetNameAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

func (SetNameAction) ProcessUserInput

func (a SetNameAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (SetNameAction) WrongInput

func (a SetNameAction) WrongInput() string

type SetRadiusAction

type SetRadiusAction struct {
	Action
}

func NewSetRadiusAction

func NewSetRadiusAction(subID string) SetRadiusAction

func (SetRadiusAction) Perform

func (a SetRadiusAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

func (SetRadiusAction) ProcessUserInput

func (a SetRadiusAction) ProcessUserInput(bot *tgbotapi.BotAPI, update *tgbotapi.Update, s storage.Service)

func (SetRadiusAction) WrongInput

func (a SetRadiusAction) WrongInput() string

type SetSourceAction

type SetSourceAction struct {
	Action
}

func NewSetSourceAction

func NewSetSourceAction(subID, sourceID, confirm string) SetSourceAction

func (SetSourceAction) Perform

func (a SetSourceAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

type SettingsAction

type SettingsAction struct {
	Action
}

func NewSettingsAction

func NewSettingsAction(reset ResetInputType) SettingsAction

func (SettingsAction) Perform

func (a SettingsAction) Perform(bot *tgbotapi.BotAPI, msg *tgbotapi.Message, s storage.Service)

type Source

type Source struct {
	Name        string
	Description string
	SourceID    entity.SourceID
}

type SubscriptionAction

type SubscriptionAction struct {
	Action
}

func NewSubscriptionAction

func NewSubscriptionAction(subID string, reset ResetInputType) SubscriptionAction

func (SubscriptionAction) Perform

type SubscriptionsAction

type SubscriptionsAction struct {
	Action
}

func NewSubscriptionsAction

func NewSubscriptionsAction(reset ResetInputType) SubscriptionsAction

func (SubscriptionsAction) Perform

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL