telegramnotifier

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: AGPL-3.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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