Documentation ¶
Overview ¶
Package discord is the notification for Discord
Index ¶
- type Author
- type Discord
- type Embed
- type Fields
- type Footer
- type NotifyConfig
- func (c *NotifyConfig) Config(gConf global.NotifySettings) error
- func (c *NotifyConfig) DryNotify(result probe.Result)
- func (c *NotifyConfig) DryNotifyStat(probers []probe.Prober)
- func (c *NotifyConfig) NewDiscord(result probe.Result) Discord
- func (c *NotifyConfig) NewEmbed() Embed
- func (c *NotifyConfig) NewEmbeds(probers []probe.Prober) []Discord
- func (c *NotifyConfig) NewField(result probe.Result, inline bool) Fields
- func (c *NotifyConfig) Notify(result probe.Result)
- func (c *NotifyConfig) NotifyStat(probers []probe.Prober)
- func (c *NotifyConfig) SendDiscordNotification(discord Discord, tag string) error
- type Thumbnail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Author struct { Name string `json:"name"` URL string `json:"url"` IconURL string `json:"icon_url"` }
Author is an object which includes three values: - name - sets name. - url - sets link. Requires name value. If used, transforms name into hyperlink. - icon_url - sets avatar. Requires name value.
type Discord ¶
type Discord struct { Username string `json:"username"` AvatarURL string `json:"avatar_url"` Content string `json:"content"` Embeds []Embed `json:"embeds"` }
Discord is the struct for all of the discrod json.
type Embed ¶
type Embed struct { Author Author `json:"author"` Title string `json:"title"` URL string `json:"url"` Color int `json:"color"` Description string `json:"description"` Timestamp string `json:"timestamp"` //"YYYY-MM-DDTHH:MM:SS.MSSZ" Thumbnail Thumbnail `json:"thumbnail"` Fields []Fields `json:"fields"` }
Embed is custom embeds for message sent by webhook. embeds is an array of embeds and can contain up to 10 embeds in the same message.
type Fields ¶
type Fields struct { Name string `json:"name"` Value string `json:"value"` Inline bool `json:"inline"` }
Fields allows you to use multiple title + description blocks in embed. fields is an array of field objects. Each object includes three values:
type Footer ¶
type Footer struct {}
Footer allows you to add footer to embed. footer is an object which includes two values:
- text - sets name for author object. Markdown is disabled here!!!
- icon_url - sets icon for author object. Requires text value.
type NotifyConfig ¶
type NotifyConfig struct { base.DefaultNotify `yaml:",inline"` Username string `` /* 129-byte string literal not displayed */ WebhookURL string `yaml:"webhook" json:"webhook" jsonschema:"format=uri,title=Webhook URL,description=Discord Webhook URL for the notification"` Avatar string `` /* 171-byte string literal not displayed */ Thumbnail string `` /* 186-byte string literal not displayed */ }
NotifyConfig is the slack notification configuration
func (*NotifyConfig) Config ¶
func (c *NotifyConfig) Config(gConf global.NotifySettings) error
Config configures the log files
func (*NotifyConfig) DryNotify ¶
func (c *NotifyConfig) DryNotify(result probe.Result)
DryNotify just log the notification message
func (*NotifyConfig) DryNotifyStat ¶
func (c *NotifyConfig) DryNotifyStat(probers []probe.Prober)
DryNotifyStat just log the notification message
func (*NotifyConfig) NewDiscord ¶
func (c *NotifyConfig) NewDiscord(result probe.Result) Discord
NewDiscord new a discord object from a result
func (*NotifyConfig) NewEmbed ¶
func (c *NotifyConfig) NewEmbed() Embed
NewEmbed new a embed object from a result
func (*NotifyConfig) NewEmbeds ¶
func (c *NotifyConfig) NewEmbeds(probers []probe.Prober) []Discord
NewEmbeds return a discord with multiple Embed
func (*NotifyConfig) NewField ¶
func (c *NotifyConfig) NewField(result probe.Result, inline bool) Fields
NewField new a Field object from a result
func (*NotifyConfig) Notify ¶
func (c *NotifyConfig) Notify(result probe.Result)
Notify write the message into the slack
func (*NotifyConfig) NotifyStat ¶
func (c *NotifyConfig) NotifyStat(probers []probe.Prober)
NotifyStat write the all probe stat message to slack
func (*NotifyConfig) SendDiscordNotification ¶
func (c *NotifyConfig) SendDiscordNotification(discord Discord, tag string) error
SendDiscordNotification will post to an 'Incoming Webhook' url setup in Discrod Apps.