telegram

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseButtonQuery

func ParseButtonQuery(query string) (string, int, int64, error)

ParseButtonQuery to trainName, stationEVA and hafasDate

Types

type Application

type Application interface {
	DeleteTrainAlarm(ctx context.Context, cmd application.DeleteTrainAlarmCmd) (*trainalarm.TrainAlarm, error)
	AddTrainAlarm(ctx context.Context, cmd application.AddTrainAlarmCmd) error
	UpdateTrainAlarmThreshold(ctx context.Context, cmd application.UpdateTrainAlarmThresholdCmd) error
}

Application with business logic

type HafasService

type HafasService interface {
	FindTrain(ctx context.Context, trainName string, date time.Time) (*[]marudor.HafasTrainResult, error)
}

HafasService to request train informations

type TelegramService

type TelegramService struct {
	// contains filtered or unexported fields
}

TelegramService to handle requests

func NewTelegramService

func NewTelegramService(log *logrus.Entry, repository trainalarm.Repository, application Application, hafas HafasService) *TelegramService

NewTelegramService to create a new service

func (*TelegramService) AlarmMenu

AlarmMenu to select alarm options

func (*TelegramService) Cancel

Cancel conversation state

func (*TelegramService) DeleteAlarm

DeleteAlarm from database

func (*TelegramService) EditDelay

EditDelay request train alarm threshold

func (*TelegramService) ListTrainAlarms

ListTrainAlarms command show current listalarmsings

func (*TelegramService) NewAlarm

NewAlarm request train name

func (*TelegramService) NewAlarmSelect

NewAlarmSelect parse user input and show buttons to select a train

func (*TelegramService) SaveAlarm

SaveAlarm to database

func (*TelegramService) SaveDelay

SaveDelay to database

func (*TelegramService) Start

Start new conversation and/or print help

Jump to

Keyboard shortcuts

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