webhooks

package
v0.0.0-...-366d00b Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package webhooks Implements methods for handling different webhooks

Index

Constants

View Source
const (
	// TestChannel Discord channel id for testing purposes
	TestChannel = "498093617185816626"
	// LogsChannel Discord channel for different logs like updates etc.
	LogsChannel = "493441003144085512"
	// MediaChannel Discord channel for updates about media libraries
	MediaChannel = "493440929374404618"
)
View Source
const (
	EmbedLimitTitle       = 256
	EmbedLimitDescription = 2048
	EmbedLimitFieldValue  = 1024
	EmbedLimitFieldName   = 256
	EmbedLimitField       = 25
	EmbedLimitFooter      = 2048
)

Constants for message embed character limits https://discordapp.com/developers/docs/resources/channel#embed-limits

Variables

View Source
var (
	// Discord The discordgo Session object
	Discord *discordgo.Session
)

Functions

func RegisterWebhookRoutes

func RegisterWebhookRoutes(router *gin.RouterGroup)

RegisterWebhookRoutes Register all routes for different webhooks

Types

type EmbedBuilder

type EmbedBuilder struct {
	*discordgo.MessageEmbed
}

EmbedBuilder Struct to wrap discordgo's MessageEmbed

func NewEmbed

func NewEmbed() *EmbedBuilder

NewEmbed returns a new embed object

func (*EmbedBuilder) AddField

func (e *EmbedBuilder) AddField(name, value string) *EmbedBuilder

AddField [name] [value]

func (*EmbedBuilder) InlineAllFields

func (e *EmbedBuilder) InlineAllFields() *EmbedBuilder

InlineAllFields sets all fields in the embed to be inline

func (*EmbedBuilder) SetAuthor

func (e *EmbedBuilder) SetAuthor(args ...string) *EmbedBuilder

SetAuthor Set discordgo.MessageEmbedAuthor https://discordapp.com/developers/docs/resources/channel#embed-object-embed-author-structure

func (*EmbedBuilder) SetColor

func (e *EmbedBuilder) SetColor(clr int) *EmbedBuilder

SetColor Set color code of the embed

func (*EmbedBuilder) SetDescription

func (e *EmbedBuilder) SetDescription(description string) *EmbedBuilder

SetDescription description of the discordgo.MessageEmbed object

func (*EmbedBuilder) SetFooter

func (e *EmbedBuilder) SetFooter(args ...string) *EmbedBuilder

SetFooter [Text] [iconURL]

func (*EmbedBuilder) SetImage

func (e *EmbedBuilder) SetImage(args ...string) *EmbedBuilder

SetImage ...

func (*EmbedBuilder) SetThumbnail

func (e *EmbedBuilder) SetThumbnail(args ...string) *EmbedBuilder

SetThumbnail The discordgo.MessageEmbedThumbnail struct of the EmbedMessage https://discordapp.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure

func (*EmbedBuilder) SetTimestamp

func (e *EmbedBuilder) SetTimestamp(args ...time.Time) *EmbedBuilder

SetTimestamp Set the Timestamp. Defaults to current time and considers only the first argument if more than one given

func (*EmbedBuilder) SetTitle

func (e *EmbedBuilder) SetTitle(name string) *EmbedBuilder

SetTitle Member function of Embed to

func (*EmbedBuilder) SetURL

func (e *EmbedBuilder) SetURL(URL string) *EmbedBuilder

SetURL Set url of the embed

func (*EmbedBuilder) Truncate

func (e *EmbedBuilder) Truncate() *EmbedBuilder

Truncate truncates any embed value over the character limit.

func (*EmbedBuilder) TruncateDescription

func (e *EmbedBuilder) TruncateDescription() *EmbedBuilder

TruncateDescription Truncate Description over the character limit

func (*EmbedBuilder) TruncateFields

func (e *EmbedBuilder) TruncateFields() *EmbedBuilder

TruncateFields truncates fields that are too long

func (*EmbedBuilder) TruncateFooter

func (e *EmbedBuilder) TruncateFooter() *EmbedBuilder

TruncateFooter Truncate Footer.Text over the character limit

func (*EmbedBuilder) TruncateTitle

func (e *EmbedBuilder) TruncateTitle() *EmbedBuilder

TruncateTitle Trunctate Title over the character limit

type Episode

type Episode struct {
	Title         string  `json:"title" binding:"required"`
	EpisodeNumber *uint16 `json:"episodeNumber" binding:"required"`
	SeasonNumber  *uint16 `json:"seasonNumber" binding:"required"`
	Quality       string  `json:"quality" binding:"required"`
}

Episode The structure of a single Episode in Episodes array

type RadarrJSON

type RadarrJSON struct {
	Debug     bool   `json:"debug" binding:"-"`
	EventType string `json:"eventType" binding:"required"`
	Movie     struct {
		Title string `json:"title" binding:"required"`
	}
	Release struct {
		Quality      string  `json:"quality" binding:"required"`
		Size         *uint64 `json:"size" binding:"required"`
		ReleaseTitle string  `json:"releaseTitle" binding:"required"`
		ReleaseGroup string  `json:"releaseGroup" binding:"required"`
		Indexer      string  `json:"indexer" binding:"required"`
	} `json:"release" binding:"-"`

	MovieFile struct {
		RelativePath string `json:"relativePath" binding:"required"`
		Path         string `json:"path" binding:"required"`
		Quality      string `json:"quality" binding:"required"`
		ReleaseGroup string `json:"releaseGroup" binding:"required"`
	} `json:"movieFile" binding:"-"`

	RemoteMovie struct {
		Title string  `json:"title" binding:"required"`
		Year  *uint16 `json:"year" binding:"required"`
	} `json:"remoteMovie" binding:"required"`
}

RadarrJSON The structure of Radarr's webhook requests

type ScriptJSON

type ScriptJSON struct {
	Debug       bool   `json:"debug" binding:"-"`
	Path        string `json:"path" binding:"required"`
	Description string `json:"description" binding:"required"`
	Time        *uint  `json:"time" binding:"exists"`
	Returncode  *int   `json:"returncode" binding:"exists"`
	Stderr      string `json:"stderr" binding:"-"`
	Stdout      string `json:"stdout" binding:"-"`
	Logfile     string `json:"logfile" binding:"required"`
	Type        string `json:"type" binding:"required"`
}

ScriptJSON The structure of json the script webhook expects

type SonarrJSON

type SonarrJSON struct {
	Debug     bool   `json:"debug" binding:"-"`
	EventType string `json:"eventType" binding:"required"`
	Series    struct {
		Title string `json:"title" binding:"required"`
	} `json:"series" binding:"required"`
	Episodes []Episode `json:"episodes" binding:"-"`
	Release  struct {
		Quality       string  `json:"quality" binding:"required"`
		QuaityVersion *uint16 `json:"qualityVersion" binding:"required"`
		Size          *uint64 `json:"size" binding:"required"`
	} `json:"release" binding:"-"`
	EpisodeFile struct {
		RelativePath string `json:"relativePath" binding:"required"`
		Path         string `json:"path" binding:"required"`
		Quality      string `json:"quality" binding:"required"`
	} `json:"episodeFile" binding:"-"`
	IsUpgrade bool `json:"isUpgrade" binding:"-"`
}

SonarrJSON The structure of Sonarr's webhook requests

Jump to

Keyboard shortcuts

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