discord

package
v0.0.0-...-fe8a609 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Scheme = "discord"

Scheme is the identifying part of this service's configuration URL

Variables

This section is empty.

Functions

func CreateAPIURLFromConfig

func CreateAPIURLFromConfig(config *Config) string

CreateAPIURLFromConfig takes a discord config object and creates a post url

func CreateJSONToSend

func CreateJSONToSend(message string) ([]byte, error)

CreateJSONToSend creates a JSON payload to be sent to the discord webhook API

Types

type Config

type Config struct {
	standard.QuerylessConfig
	standard.EnumlessConfig
	Channel string
	Token   string
}

Config is the configuration needed to send discord notifications

func (*Config) GetURL

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL

func (config *Config) SetURL(url *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type JSON

type JSON struct {
	Text string `json:"content"`
}

JSON is the actual notification payload

type Service

type Service struct {
	standard.Standard
	// contains filtered or unexported fields
}

Service providing Discord as a notification service

func (*Service) Initialize

func (service *Service) Initialize(configURL *url.URL, logger *log.Logger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to discord

Jump to

Keyboard shortcuts

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