telegramnotifier

package
v0.0.0-...-8d88297 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogHook

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

func NewLogHook

func NewLogHook(notifier *Notifier) *LogHook

func (*LogHook) Fire

func (t *LogHook) Fire(e *logrus.Entry) error

func (*LogHook) Levels

func (t *LogHook) Levels() []logrus.Level

type Notifier

type Notifier struct {

	// Subscribers stores the Chat objects for broadcasting public notification
	Subscribers map[int64]time.Time `json:"subscribers"`

	// Chats are the private chats that we will send private notification
	Chats map[int64]*telebot.Chat `json:"chats"`
	// contains filtered or unexported fields
}

func New

func New(bot *telebot.Bot, options ...Option) *Notifier

New returns a telegram notifier instance

func (*Notifier) AddChat

func (n *Notifier) AddChat(c *telebot.Chat)

func (*Notifier) AddSubscriber

func (n *Notifier) AddSubscriber(m *telebot.Message)

func (*Notifier) Broadcast

func (n *Notifier) Broadcast(message string)

func (*Notifier) Notify

func (n *Notifier) Notify(obj interface{}, args ...interface{})

func (*Notifier) NotifyTo

func (n *Notifier) NotifyTo(channel string, obj interface{}, args ...interface{})

func (*Notifier) SendPhoto

func (n *Notifier) SendPhoto(buffer *bytes.Buffer)

func (*Notifier) SendPhotoTo

func (n *Notifier) SendPhotoTo(channel string, buffer *bytes.Buffer)

type Option

type Option func(notifier *Notifier)

func UseBroadcast

func UseBroadcast() Option

Jump to

Keyboard shortcuts

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