Documentation ¶
Overview ¶
package to help deep refactoring stay best
Index ¶
- func HammertimeInfo() string
- func NextMeetupInfo() string
- func ReplaceUsername(text, username string) string
- type ApplicationConfig
- type BotAPI
- type Config
- type MessageProvider
- type Service
- func (s *Service) GetMessage() MessageProvider
- func (s *Service) GoAwayMessage(update *tgbotapi.Update, username string) error
- func (s *Service) Greeting(update *tgbotapi.Update, username string) error
- func (s *Service) Hammertime(update *tgbotapi.Update) error
- func (s *Service) HandleUpdate(update *tgbotapi.Update)
- func (s *Service) Listen()
- func (s *Service) NextMeetup(update *tgbotapi.Update) error
- func (s *Service) RollMessage(update *tgbotapi.Update) error
- func (s *Service) Send(update *tgbotapi.Update, text string) error
- type TelegramConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HammertimeInfo ¶
func HammertimeInfo() string
func NextMeetupInfo ¶
func NextMeetupInfo() string
func ReplaceUsername ¶
Types ¶
type ApplicationConfig ¶
func (*ApplicationConfig) UnmarshalYAML ¶
func (c *ApplicationConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type BotAPI ¶
type BotAPI interface { GetUpdatesChan(config tgbotapi.UpdateConfig) (tgbotapi.UpdatesChannel, error) Send(c tgbotapi.Chattable) (tgbotapi.Message, error) }
Generic (joke) bot API interface to use in tests, consider tgbotapi as implementation
type Config ¶
type Config struct { Telegram TelegramConfig `yaml:"telegram"` Application ApplicationConfig `yaml:"application"` }
type MessageProvider ¶
type MessageProvider interface { // GetGreeting returns a greeting message GetGreeting() string // GetCurse returns a farewell message GetCurse() string // GetRoll returns a topic message GetRoll() string }
MessageProvider common chat message repo interface
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(bot BotAPI, msg MessageProvider, logger *logrus.Entry) *Service
func NewServiceFromTgbotapi ¶
func NewServiceFromTgbotapi(apiKey string, msg MessageProvider) (*Service, error)
func (*Service) GetMessage ¶
func (s *Service) GetMessage() MessageProvider
func (*Service) GoAwayMessage ¶
func (*Service) Hammertime ¶
func (*Service) HandleUpdate ¶
func (s *Service) HandleUpdate(update *tgbotapi.Update)
func (*Service) NextMeetup ¶
func (*Service) RollMessage ¶
type TelegramConfig ¶
type TelegramConfig struct {
ApiKey string `yaml:"api_key"`
}
Click to show internal directories.
Click to hide internal directories.