telegram

package
v0.0.0-...-c7c5a6c Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALERT_CONTEXT_KEY  = "alert"
	ALERTS_CONTEXT_KEY = "alerts"
	INVITE_CONTEXT_KEY = "invite"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	APIKey string `env:"TELEGRAM_API_KEY"`
}

Configuration of the telegram bot

type Failable

type Failable func(u Update, ctx dialog.ValueStore) (dialog.Status, error)

Failable is a function used for dialog.Failable functions

type Scope

type Scope byte
const (
	PRIVATE_SCOPE Scope = 0x01
	GROUP_SCOPE   Scope = 0x02
	ADMIN_SCOPE   Scope = 0x04

	EVERYWHERE Scope = 0xFF
)

func (Scope) Add

func (s Scope) Add(in Scope) Scope

func (Scope) IsAdmin

func (s Scope) IsAdmin() bool

func (Scope) IsGroup

func (s Scope) IsGroup() bool

func (Scope) IsPrivate

func (s Scope) IsPrivate() bool

type Telegram

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

Telegram represents the telegram interface

func NewTelegram

func NewTelegram(config *Configuration, repository repository.Repository, webserver web.Webserver, logger *logrus.Logger, lib messages.Library) (*Telegram, error)

NewTelegram creates a new instance of a Telegram

func (*Telegram) NotifyAll

func (t *Telegram) NotifyAll(token, message string, file *multipart.FileHeader) error

NotifyAll notifies all clients associated to the alert

func (*Telegram) Quit

func (t *Telegram) Quit() error

Quit shuts down the telegram bot

func (*Telegram) Run

func (t *Telegram) Run(wg *sync.WaitGroup) error

Run runs the telegram bot

type Update

type Update struct {
	Update     tgbotapi.Update
	User       models.User
	Text       string
	ChatID     int64
	Dictionary messages.Dictionary
	Language   string
}

Update represents the struct passed to the dialog handler

Jump to

Keyboard shortcuts

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