discordwebhook

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Overview

Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(whurl string, w Webhook) *http.Request

Send returns a request for a Discord webhook.

func Validate

func Validate(resp *http.Response) error

Validate validates the response from Discord.

Types

type EmbedAuthor added in v1.8.0

type EmbedAuthor struct {
	Name    string `json:"name"`
	URL     string `json:"url"`
	IconURL string `json:"icon_url"`
}

type EmbedField

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

EmbedField is an individual field being embedded in a message.

type EmbedFooter

type EmbedFooter struct {
	Text    string `json:"text"`
	IconURL string `json:"icon_url"`
}

EmbedFooter is the message footer.

type Embeds

type Embeds struct {
	Title       string       `json:"title,omitempty"`
	Description string       `json:"description,omitempty"`
	URL         string       `json:"url,omitempty"`
	Author      *EmbedAuthor `json:"author,omitempty"`
	Fields      []EmbedField `json:"fields,omitempty"`
	Footer      *EmbedFooter `json:"footer,omitempty"`
}

Embeds is a set of embed fields and a footer.

type Webhook

type Webhook struct {
	Content         string              `json:"content,omitempty"`
	Username        string              `json:"username,omitempty"`
	AvatarURL       string              `json:"avatar_url"`
	Embeds          []Embeds            `json:"embeds,omitempty"`
	AllowedMentions map[string][]string `json:"allowed_mentions"`
}

Webhook is the parent structure fired off to Discord.

Jump to

Keyboard shortcuts

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