telegram

package
v1.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTelegramLinksPreviewDisable = false
View Source
const DefaultTelegramNotificationDisable = false
View Source
const DefaultTelegramURL = "https://api.telegram.org/bot"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Whether Telegram integration is enabled.
	Enabled bool `toml:"enabled" override:"enabled"`
	// The Telegram Bot URL, should not need to be changed.
	URL string `toml:"url" override:"url"`
	// The Telegram Bot Token, can be obtained From @BotFather.
	Token string `toml:"token" override:"token,redact"`
	// The default channel, can be overridden per alert.
	ChatId string `toml:"chat-id" override:"chat-id"`
	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
	ParseMode string `toml:"parse-mode" override:"parse-mode"`
	// Disables link previews for links in this message
	DisableWebPagePreview bool `toml:"disable-web-page-preview" override:"disable-web-page-preview"`
	// Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
	DisableNotification bool `toml:"disable-notification" override:"disable-notification"`
	// Whether all alerts should automatically post to Telegram
	Global bool `toml:"global" override:"global"`
	// Whether all alerts should automatically use stateChangesOnly mode.
	// Only applies if global is also set.
	StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate added in v1.1.0

func (c Config) Validate() error

type HandlerConfig added in v1.2.0

type HandlerConfig struct {
	// Telegram user/group ID to post messages to.
	// If empty uses the chati-d from the configuration.
	ChatId string `mapstructure:"chat-id"`

	// Parse node, defaults to Mardown
	// If empty uses the parse-mode from the configuration.
	ParseMode string `mapstructure:"parse-mode"`

	// Web Page preview
	// If empty uses the disable-web-page-preview from the configuration.
	DisableWebPagePreview bool `mapstructure:"disable-web-page-preview"`

	// Disables Notification
	// If empty uses the disable-notification from the configuration.
	DisableNotification bool `mapstructure:"disable-notification"`
}

type Service

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

func NewService

func NewService(c Config, l *log.Logger) *Service

func (*Service) Alert

func (s *Service) Alert(chatId, parseMode, message string, disableWebPagePreview, disableNotification bool) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) Global

func (s *Service) Global() bool

func (*Service) Handler added in v1.2.0

func (s *Service) Handler(c HandlerConfig, l *log.Logger) alert.Handler

func (*Service) Open

func (s *Service) Open() error

func (*Service) StateChangesOnly

func (s *Service) StateChangesOnly() bool

func (*Service) Test added in v1.1.0

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions added in v1.1.0

func (s *Service) TestOptions() interface{}

func (*Service) Update added in v1.1.0

func (s *Service) Update(newConfig []interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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