discord_webhook

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DiscordAPIEndpoint = "https://discord.com/api"

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	URL         string `json:"url,omitempty"`
	Description string `json:"description,omitempty"`
	ID          string `json:"id"`
	ProxyURL    string `json:"proxy_url,omitempty"`
	Filename    string `json:"filename,omitempty"`
	Width       int    `json:"width,omitempty"`
	Height      int    `json:"height,omitempty"`
	Size        int    `json:"size,omitempty"`
}

type Component

type Component struct {
	Type        int              `json:"type"`
	CustomID    string           `json:"custom_id,omitempty"`
	Disabled    bool             `json:"disabled,omitempty"`
	Style       int              `json:"style,omitempty"`
	Label       string           `json:"label,omitempty"`
	URL         string           `json:"url,omitempty"`
	Placeholder string           `json:"placeholder,omitempty"`
	MinValues   int              `json:"min_values,omitempty"`
	MaxValues   int              `json:"max_values,omitempty"`
	Components  []Component      `json:"components,omitempty"`
	Emoji       *discordgo.Emoji `json:"emoji,omitempty"`
	Options     []Option         `json:"options,omitempty"`
}

type File

type File struct {
	FileName    string
	Reader      io.Reader
	ContentType string
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(token string) *Handler

func (*Handler) Delete

func (h *Handler) Delete(channelID, messageID string) error

func (*Handler) Edit

func (h *Handler) Edit(channelID, messageID string, message Message, files []File) (*Message, error)

func (*Handler) GetChannelWebhook

func (h *Handler) GetChannelWebhook(channelID string) *discordgo.Webhook

func (*Handler) GetGuildChannels

func (h *Handler) GetGuildChannels(guildID string) (channels []discordgo.Channel, err error)

func (*Handler) GetMessage

func (h *Handler) GetMessage(channelID, messageID string) (message discordgo.Message, err error)

func (*Handler) GetMessages

func (h *Handler) GetMessages(channelID string, around string) (messages []discordgo.Message, err error)

func (*Handler) Reset

func (h *Handler) Reset()

func (*Handler) Send

func (h *Handler) Send(channelID string, message Message, wait bool, files []File) (*Message, error)

func (*Handler) SetHookURI

func (h *Handler) SetHookURI(uri string) error

type Message

type Message struct {
	Components  []Component  `json:"components,omitempty"`
	AvaterURL   string       `json:"avatar_url,omitempty"`
	Attachments []Attachment `json:"attachments"`
	UserName    string       `json:"username,omitempty"`

	ID               string                        `json:"id"`
	ChannelID        string                        `json:"channel_id"`
	GuildID          string                        `json:"guild_id,omitempty"`
	Content          string                        `json:"content"`
	Timestamp        time.Time                     `json:"timestamp"`
	EditedTimestamp  time.Time                     `json:"edited_timestamp"`
	MentionRoles     []string                      `json:"mention_roles"`
	TTS              bool                          `json:"tts"`
	MentionEveryone  bool                          `json:"mention_everyone"`
	Author           *discordgo.User               `json:"author"`
	Embeds           []*discordgo.MessageEmbed     `json:"embeds"`
	Mentions         []*discordgo.User             `json:"mentions"`
	Reactions        []*discordgo.MessageReactions `json:"reactions"`
	Pinned           bool                          `json:"pinned"`
	Type             discordgo.MessageType         `json:"type"`
	WebhookID        string                        `json:"webhook_id"`
	Member           *discordgo.Member             `json:"member"`
	MentionChannels  []*discordgo.Channel          `json:"mention_channels"`
	Activity         *discordgo.MessageActivity    `json:"activity"`
	Application      *discordgo.MessageApplication `json:"application"`
	MessageReference *discordgo.MessageReference   `json:"message_reference"`
	Flags            discordgo.MessageFlags        `json:"flags"`
}

type Option

type Option struct {
	Label       string           `json:"label"`
	Value       string           `json:"value"`
	Description string           `json:"description,omitempty"`
	Emoji       *discordgo.Emoji `json:"emoji,omitempty"`
	Default     bool             `json:"default,omitempty"`
}

Jump to

Keyboard shortcuts

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