Documentation
¶
Index ¶
Constants ¶
View Source
const ( USERNAME string = "Beast" ICON_URL string = "https://i.ibb.co/sjC5dRY/beast-eye-39371.png" CHANNEL_NAME string = "#beast" )
Variables ¶
This section is empty.
Functions ¶
func SendNotification ¶
func SendNotification(nType NotificationType, message string) error
Types ¶
type Attachment ¶
type Attachment struct { Fallback string `json:"fallback,omitempty"` Color NotificationColor `json:"color,omitempty"` PreText string `json:"pretext,omitempty"` AuthorName string `json:"author_name,omitempty"` AuthorLink string `json:"author_link,omitempty"` AuthorIcon string `json:"author_icon,omitempty"` Title string `json:"title,omitempty"` TitleLink string `json:"title_link,omitempty"` Text string `json:"text,omitempty"` ImageUrl string `json:"image_url,omitempty"` Timestamp int64 `json:"ts,omitempty"` MarkdownIn []string `json:"mrkdwn_in,omitempty"` CallbackID string `json:"callback_id,omitempty"` ThumbnailUrl string `json:"thumb_url,omitempty"` }
type DiscordNotificationProvider ¶
type DiscordNotificationProvider struct {
Request
}
func (*DiscordNotificationProvider) SendNotification ¶
func (d *DiscordNotificationProvider) SendNotification(nType NotificationType, msg string) error
type NotificationColor ¶
type NotificationColor string
const ( ErrorColor NotificationColor = "#FF0000" WarningColor NotificationColor = "#FF4500" SuccessColor NotificationColor = "#32CD32" )
type NotificationType ¶
type NotificationType int
const ( Success NotificationType = iota Warning Error )
type Notifier ¶
type Notifier interface {
SendNotification(nType NotificationType, msg string) error
}
func NewNotifier ¶
func NewNotifier(url *url.URL, ProviderType ProviderTypeEnum) Notifier
In the Discord notification provider it was using the same payload which was used for slack. By writing "/slack" in the discord WebHookURL, it execute Slack-Compatible Webhook
type PostPayload ¶
type PostPayload struct { Parse string `json:"parse,omitempty"` Username string `json:"username,omitempty"` IconUrl string `json:"icon_url,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` Channel string `json:"channel,omitempty"` Text string `json:"text,omitempty"` Attachments []Attachment `json:"attachments,omitempty"` Markdown bool `json:"mrkdwn,omitempty"` }
type ProviderTypeEnum ¶
type ProviderTypeEnum int
const ( DiscordProvider ProviderTypeEnum = 1 + iota SlackProvider )
type Request ¶
type Request struct { WebHookURL string PostPayload }
func (*Request) FillReqParams ¶
type SlackNotificationProvider ¶
type SlackNotificationProvider struct {
Request
}
func (*SlackNotificationProvider) SendNotification ¶
func (s *SlackNotificationProvider) SendNotification(nType NotificationType, msg string) error
Click to show internal directories.
Click to hide internal directories.