Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscordConfig ¶
type DiscordConfig struct { // Token is the OAuth token for pushing messages. Token string `json:"Token"` // SubChannels is the list of channels for posting messages. // // Each channel must start with an `@` symbol. For example: @astra_alert SubChannels []string `json:"SubChannels"` // MessageQueueSize specifies the message queue size. MessageQueueSize int `json:"MessageQueueSize"` // EnabledMessageTypes specifies which message types are allowed to be posted. EnabledMessageTypes map[string]bool `json:"EnabledMessageTypes"` }
DiscordConfig consists of configurations of the DiscordHook.
func DefaultConfig ¶
func DefaultConfig() DiscordConfig
func (DiscordConfig) IsValid ¶
func (cfg DiscordConfig) IsValid() (bool, error)
IsValid checks if the current TeleConfig is valid.
type DiscordHook ¶
DiscordHook implements a Discord webhook for pushing messages.
func NewDiscordHook ¶
func NewDiscordHook(cfg DiscordConfig, log logger.Logger) (*DiscordHook, error)
NewDiscordHook creates and returns a new DiscordHook with the given DiscordConfig.
func (*DiscordHook) Alert ¶
func (h *DiscordHook) Alert(msg interface{}) error
Alert pushes the given alert message to the TeleHook.
func (*DiscordHook) Error ¶
func (h *DiscordHook) Error(msg interface{}) error
Error pushes the given error message to the TeleHook.
func (*DiscordHook) Info ¶
func (h *DiscordHook) Info(msg interface{}) error
Info pushes the given information message to the TeleHook.
func (*DiscordHook) Ping ¶
func (h *DiscordHook) Ping() error
Ping checks if the remote Tele service is alive.
Click to show internal directories.
Click to hide internal directories.