telegram

package
v0.0.0-...-4811c7a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Options        *Options       // Telegram options
	Logger         service.Logger // logger
	VerboseLogging bool           // Switch on verbose logging
}

Client is used to send telegram messages

func (*Client) Initialize

func (c *Client) Initialize() error

Initialize initializes the telegram client

func (*Client) SendMessage

func (c *Client) SendMessage(m string) error

SendMessage sends the specified message to the telegram chat specified in Options

type Options

type Options struct {
	EnableTelegram bool   `json:"enableTelegram"` // Enable Telegram messages
	BotID          string `json:"botId"`          // Bot Identifier
	ChatID         string `json:"chatId"`         // Chat Identifier
}

Options holds the configuration options for sending Telegram messages

func (*Options) ReadFromFile

func (o *Options) ReadFromFile(path string) error

ReadFromFile will read the configuration settings from the specified file

func (*Options) WriteToFile

func (o *Options) WriteToFile(path string) error

WriteToFile will write the configuration settings to the specified file

type Response

type Response struct {
	OK          bool   `json:"ok"`          // True if call succeeded
	ErrorCode   int    `json:"error_code"`  // The error code
	Description string `json:"description"` // Error description
}

Response holds the information returned from a telegram message call

func (*Response) ReadFrom

func (s *Response) ReadFrom(r io.ReadCloser) error

ReadFrom will read the request body and deserialize it into the request values

Jump to

Keyboard shortcuts

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