discord

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	InteractionCreateEvent  = "INTERACTION_CREATE"
	InteractionSuccessEvent = "INTERACTION_SUCCESS"
	MessageCreateEvent      = "MESSAGE_CREATE"
	MessageUpdateEvent      = "MESSAGE_UPDATE"
)

Variables

View Source
var ErrMessageNotFound = &Error{Message: "Unknown Message", Code: 10008, temporary: false}

Functions

This section is empty.

Types

type ApplicationCommandSearch

type ApplicationCommandSearch struct {
	Applications []*discordgo.Application        `json:"applications"`
	Commands     []*discordgo.ApplicationCommand `json:"application_commands"`
}

type Client

type Client struct {
	Referer string
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg *Config) (*Client, error)

func (*Client) DM

func (c *Client) DM(userID string) string

func (*Client) Do

func (c *Client) Do(ctx context.Context, method string, path string, body interface{}) ([]byte, error)

func (*Client) Download

func (c *Client) Download(ctx context.Context, u string, output string) error

func (*Client) OnEvent

func (c *Client) OnEvent(callback func(*discordgo.Event))

func (*Client) Session

func (c *Client) Session() string

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

func (*Client) Stop

func (c *Client) Stop() error

type Component

type Component struct {
	Type       int          `json:"type"`
	Style      int          `json:"style,omitempty"`
	Label      string       `json:"label,omitempty"`
	CustomID   string       `json:"custom_id,omitempty"`
	Components []*Component `json:"components,omitempty"`
}

type Config

type Config struct {
	Token           string
	SuperProperties string
	Locale          string
	UserAgent       string
	Referer         string
	HTTPClient      *http.Client
	Dialer          func(ctx context.Context, network, addr string) (net.Conn, error)
	Debug           bool
}

type Error added in v1.0.12

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

func (Error) Error added in v1.0.12

func (e Error) Error() string

func (Error) Temporary added in v1.0.12

func (e Error) Temporary() bool

type Interaction added in v1.1.4

type Interaction struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type int    `json:"type"`
}

type InteractionCommand

type InteractionCommand struct {
	Type          int                    `json:"type"`
	ApplicationID string                 `json:"application_id"`
	GuildID       string                 `json:"guild_id,omitempty"`
	ChannelID     string                 `json:"channel_id"`
	SessionID     string                 `json:"session_id"`
	Data          InteractionCommandData `json:"data"`
	Nonce         string                 `json:"nonce,omitempty"`
}

type InteractionCommandData

type InteractionCommandData struct {
	Version            string                                               `json:"version"`
	ID                 string                                               `json:"id"`
	Name               string                                               `json:"name"`
	Type               int                                                  `json:"type"`
	Options            []*discordgo.ApplicationCommandInteractionDataOption `json:"options"`
	ApplicationCommand *discordgo.ApplicationCommand                        `json:"application_command"`
	Attachments        []*discordgo.MessageAttachment                       `json:"attachments"`
}

type InteractionComponent

type InteractionComponent struct {
	Type          int                      `json:"type"`
	ApplicationID string                   `json:"application_id"`
	ChannelID     string                   `json:"channel_id"`
	GuildID       string                   `json:"guild_id,omitempty"`
	SessionID     string                   `json:"session_id"`
	Data          InteractionComponentData `json:"data"`
	Nonce         string                   `json:"nonce,omitempty"`
	MessageID     string                   `json:"message_id"`
}

type InteractionComponentData

type InteractionComponentData struct {
	ComponentType int    `json:"component_type"`
	CustomID      string `json:"custom_id"`
}

type Message

type Message struct {
	//discordgo.Message
	// The ID of the message.
	ID string `json:"id"`

	// The ID of the channel in which the message was sent.
	ChannelID string `json:"channel_id"`

	// The ID of the guild in which the message was sent.
	GuildID string `json:"guild_id,omitempty"`

	// The content of the message.
	Content string `json:"content"`

	// Nonce used for validating a message was sent.
	Nonce string `json:"nonce"`

	// A list of attachments present in the message.
	Attachments []*discordgo.MessageAttachment `json:"attachments"`

	// A list of components attached to the message.
	Components []*Component `json:"components"`

	// A list of embeds present in the message.
	Embeds []*discordgo.MessageEmbed `json:"embeds"`

	// Interaction data
	Interaction *Interaction `json:"interaction"`
}

type SuperProperties

type SuperProperties struct {
	OS                  string      `json:"os"`
	Browser             string      `json:"browser"`
	Device              string      `json:"device"`
	SystemLocale        string      `json:"system_locale"`
	BrowserUserAgent    string      `json:"browser_user_agent"`
	BrowserVersion      string      `json:"browser_version"`
	OSVersion           string      `json:"os_version"`
	Referrer            string      `json:"referrer"`
	ReferringDomain     string      `json:"referring_domain"`
	ReferrerCurrent     string      `json:"referrer_current"`
	ReferringDomainCurr string      `json:"referring_domain_current"`
	ReleaseChannel      string      `json:"release_channel"`
	ClientBuildNumber   int         `json:"client_build_number"`
	ClientEventSource   interface{} `json:"client_event_source"`
	// contains filtered or unexported fields
}

func (*SuperProperties) Marshal

func (s *SuperProperties) Marshal() error

func (*SuperProperties) Unmarshal

func (s *SuperProperties) Unmarshal() error

type User

type User struct {
	discordgo.User
	Profile     UserProfile     `json:"user_profile"`
	Application UserApplication `json:"application"`
}

type UserApplication

type UserApplication struct {
	ID       string `json:"id"`
	Flags    int    `json:"flags"`
	Verified bool   `json:"verified"`
}

type UserProfile

type UserProfile struct {
	Bio string `json:"bio"`
}

Jump to

Keyboard shortcuts

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