telegram

package
v0.0.0-...-33dae29 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatForMD

func FormatForMD(s string) string

func ZapCoreWrapper

func ZapCoreWrapper(tc *Client, cf *configfile.ConfigFile) func(core zapcore.Core) zapcore.Core

Types

type Client

type Client struct {
	Logger *log.Logger
	Chat   *telebot.Chat
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, l *log.Logger, cf *configfile.ConfigFile) (*Client, error)

Documentation : https://github.com/tucnak/telebot

func (*Client) CreateHandler

func (c *Client) CreateHandler(endpoint interface{}, handlerFunc telebot.HandlerFunc)

func (*Client) Send

func (c *Client) Send(message string)

func (*Client) StartBot

func (c *Client) StartBot()

type TelegramZapCore

type TelegramZapCore struct {
	zapcore.Core

	TelegramClient *Client
	ConfigFile     *configfile.ConfigFile
}

Wrapper around the ZapLogger Core. We just want to catch messages to send them to Telegram, so we forward all the logic to the wrapped Core

func (*TelegramZapCore) Check

Check determines whether the supplied Entry should be logged (using the embedded LevelEnabler and possibly some extra logic). If the entry should be logged, the Core adds itself to the CheckedEntry and returns the result.

Callers must use Check before calling Write.

func (*TelegramZapCore) With

func (f *TelegramZapCore) With(fields []zap.Field) zapcore.Core

With adds structured context to the Core.

func (*TelegramZapCore) Write

func (f *TelegramZapCore) Write(e zapcore.Entry, fields []zap.Field) error

Write serializes the Entry and any Fields supplied at the log site and writes them to their destination.

If called, Write should always log the Entry and Fields; it should not replicate the logic of Check.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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