shoutrrr: Index | Files

package discord

import ""


Package Files

discord.go discord_config.go discord_json.go


const Scheme = "discord"

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

func CreateAPIURLFromConfig Uses

func CreateAPIURLFromConfig(config *Config) string

CreateAPIURLFromConfig takes a discord config object and creates a post url

func CreateJSONToSend Uses

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

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

type Config Uses

type Config struct {
    Channel string
    Token   string
    JSON    bool

Config is the configuration needed to send discord notifications

func (*Config) GetURL Uses

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

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

func (*Config) SetURL Uses

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

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

type JSON Uses

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

JSON is the actual notification payload

type Service Uses

type Service struct {
    // contains filtered or unexported fields

Service providing Discord as a notification service

func (*Service) Initialize Uses

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 Uses

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

Send a notification message to discord

Package discord imports 9 packages (graph) and is imported by 1 packages. Updated 2020-11-19. Refresh now. Tools for package owners.