telegram

package
v0.0.0-...-0140298 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWhitelistUserMiddlewarePoller

func NewWhitelistUserMiddlewarePoller(
	originalPoller telebot.Poller,
	allowedUsers []subscription.User) *telebot.MiddlewarePoller

NewWhitelistUserMiddlewarePoller instantiates new WhitelistUserMiddlewarePoller object

func ParseStringWithArticle

func ParseStringWithArticle(msg string) (string, error)

ParseStringWithArticle parses a string and extracts the article number

Current implementation supports the following formats:

  1. Raw article number: 111222, 111-222, 111_222
  2. Link to shop item page: https://www.domain.com/.../111222

Types

type Bot

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

Bot works as a frontend to the systems

func New

func New(httpClient *next.Client, mediator *mediator.SubscriptionMediator, config *Config) (*Bot, error)

New instantiates new Bot object

func (*Bot) Start

func (b *Bot) Start()

Start begins the message loop

func (*Bot) Stop

func (b *Bot) Stop()

type CallbackData

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

func NewCallbackData

func NewCallbackData() *CallbackData

func (*CallbackData) AddItem

func (cd *CallbackData) AddItem(key string, value interface{})

func (*CallbackData) Decode

func (cd *CallbackData) Decode(s string) (map[string]interface{}, error)

func (*CallbackData) Encode

func (cd *CallbackData) Encode() (string, error)

type ChatID

type ChatID string

func (ChatID) Recipient

func (cid ChatID) Recipient() string

type Config

type Config struct {
	AllowedUsers []subscription.User
	Token        string
}

Config holds telegram bot configuration

type WhitelistUserMiddlewarePoller

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

WhitelistUserMiddlewarePoller filters user with whitelisting strategy

Jump to

Keyboard shortcuts

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