discord

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "discord"

Variables

This section is empty.

Functions

This section is empty.

Types

type Embed

type Embed struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Color       int      `json:"color"`
	Fields      []*Field `json:"fields"`
}

func (*Embed) AddField

func (e *Embed) AddField(field *Field)

type Field

type Field struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline"`
}

type Notifier

type Notifier struct {
	Webhook string `json:"webhook"`
}

func New

func New(config json.RawMessage) (Notifier, error)

New creates a new Notifier instance based on json config

func (Notifier) Notify

func (s Notifier) Notify(results []types.Result) error

Notify implements notifier interface

func (Notifier) Send

func (s Notifier) Send(result types.Result) error

Send request via Slack API to create incident

func (Notifier) Type

func (Notifier) Type() string

Type returns the notifier package name

type Payload

type Payload struct {
	Title   string   `json:"username"`
	Content string   `json:"content"`
	Avatar  string   `json:"avatar_url"`
	Embeds  []*Embed `json:"embeds"`
}

func (*Payload) AddEmbed

func (p *Payload) AddEmbed(embed *Embed)

Jump to

Keyboard shortcuts

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