Documentation ¶
Index ¶
- Variables
- type DiscordJSONClient
- func (d *DiscordJSONClient) BulkOverwriteGlobalCommands(ctx context.Context, aid string, cmds []entity.ApplicationCommand) (resCmds []entity.ApplicationCommand, err error)
- func (d *DiscordJSONClient) BulkOverwriteGuildCommandPermissions(ctx context.Context, aid string, gid snowflake.Snowflake, ...) (resPerms []entity.ApplicationCommandPermissions, err error)
- func (d *DiscordJSONClient) BulkOverwriteGuildCommands(ctx context.Context, aid string, gid snowflake.Snowflake, ...) (resCmds []entity.ApplicationCommand, err error)
- func (d *DiscordJSONClient) CreateReaction(ctx context.Context, cid, mid snowflake.Snowflake, emoji string) (resp *http.Response, err error)
- func (d *DiscordJSONClient) DeferInteractionResponse(ctx context.Context, ixID snowflake.Snowflake, ixToken string) error
- func (d *DiscordJSONClient) GetGateway(ctx context.Context) (entity.Gateway, error)
- func (d *DiscordJSONClient) GetGlobalCommands(ctx context.Context, aid string) (cmds []entity.ApplicationCommand, err error)
- func (d *DiscordJSONClient) GetGuildCommands(ctx context.Context, aid string, gid snowflake.Snowflake) (cmds []entity.ApplicationCommand, err error)
- func (d *DiscordJSONClient) GetGuildMember(ctx context.Context, gid, uid snowflake.Snowflake) (respData entity.GuildMember, err error)
- func (d *DiscordJSONClient) GetInteractionResponse(ctx context.Context, aid snowflake.Snowflake, ixToken string) (respData entity.Message, err error)
- func (d *DiscordJSONClient) GetMessage(ctx context.Context, cid, mid snowflake.Snowflake) (respData entity.Message, err error)
- func (d *DiscordJSONClient) SendInteractionAutocomplete(ctx context.Context, ixID snowflake.Snowflake, ixToken string, m marshaler) error
- func (d *DiscordJSONClient) SendInteractionMessage(ctx context.Context, ixID snowflake.Snowflake, ixToken string, m marshaler) error
- func (d *DiscordJSONClient) SendMessage(ctx context.Context, cid snowflake.Snowflake, m marshaler) (respData entity.Message, err error)
- func (d *DiscordJSONClient) SetDebug(val bool)
- type Embed
- type EmbedField
- type EmbedFooter
- type HTTPClient
- type InteractionAutocompleteResponse
- type InteractionCallbackMessage
- type InteractionCallbackType
- type Logger
- type Message
- type MessageReference
- type MessageWithEmbed
Constants ¶
This section is empty.
Variables ¶
View Source
var Err = errors.New("error response")
Err is the error that is wrapped and returned when there is a non-200 api response
Functions ¶
This section is empty.
Types ¶
type DiscordJSONClient ¶
type DiscordJSONClient struct {
// contains filtered or unexported fields
}
func NewDiscordJSONClient ¶
func NewDiscordJSONClient(deps dependencies, apiURL string) *DiscordJSONClient
func (*DiscordJSONClient) BulkOverwriteGlobalCommands ¶
func (d *DiscordJSONClient) BulkOverwriteGlobalCommands(ctx context.Context, aid string, cmds []entity.ApplicationCommand) (resCmds []entity.ApplicationCommand, err error)
func (*DiscordJSONClient) BulkOverwriteGuildCommandPermissions ¶ added in v23.2.0
func (d *DiscordJSONClient) BulkOverwriteGuildCommandPermissions(ctx context.Context, aid string, gid snowflake.Snowflake, perms []entity.ApplicationCommandPermissions) (resPerms []entity.ApplicationCommandPermissions, err error)
func (*DiscordJSONClient) BulkOverwriteGuildCommands ¶
func (d *DiscordJSONClient) BulkOverwriteGuildCommands(ctx context.Context, aid string, gid snowflake.Snowflake, cmds []entity.ApplicationCommand) (resCmds []entity.ApplicationCommand, err error)
func (*DiscordJSONClient) CreateReaction ¶
func (*DiscordJSONClient) DeferInteractionResponse ¶ added in v23.5.0
func (*DiscordJSONClient) GetGateway ¶
func (*DiscordJSONClient) GetGlobalCommands ¶
func (d *DiscordJSONClient) GetGlobalCommands(ctx context.Context, aid string) (cmds []entity.ApplicationCommand, err error)
func (*DiscordJSONClient) GetGuildCommands ¶
func (d *DiscordJSONClient) GetGuildCommands(ctx context.Context, aid string, gid snowflake.Snowflake) (cmds []entity.ApplicationCommand, err error)
func (*DiscordJSONClient) GetGuildMember ¶
func (d *DiscordJSONClient) GetGuildMember(ctx context.Context, gid, uid snowflake.Snowflake) (respData entity.GuildMember, err error)
func (*DiscordJSONClient) GetInteractionResponse ¶
func (*DiscordJSONClient) GetMessage ¶
func (*DiscordJSONClient) SendInteractionAutocomplete ¶ added in v23.1.0
func (*DiscordJSONClient) SendInteractionMessage ¶
func (*DiscordJSONClient) SendMessage ¶
func (*DiscordJSONClient) SetDebug ¶
func (d *DiscordJSONClient) SetDebug(val bool)
type Embed ¶
type Embed struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` Timestamp string `json:"timestamp,omitempty"` Color int `json:"color,omitempty"` Fields []EmbedField `json:"fields,omitempty"` }
Embed is a json object that represents an embed in a MessageWithEmbed
type EmbedField ¶
type EmbedField struct { Name string `json:"name"` Value string `json:"value"` Inline bool `json:"inline"` }
EmbedField is a json object that represents a field in an Embed
type EmbedFooter ¶
type EmbedFooter struct {
}EmbedFooter is a json object that represents the footer of an embed
type HTTPClient ¶
type HTTPClient interface { SetHeaders(http.Header) Get(context.Context, string, *http.Header) (*http.Response, error) GetBody(context.Context, string, *http.Header) (*http.Response, []byte, error) GetJSON(context.Context, string, *http.Header, interface{}) (*http.Response, error) Post(context.Context, string, *http.Header, io.Reader) (*http.Response, error) PostBody(context.Context, string, *http.Header, io.Reader) (*http.Response, []byte, error) PostJSON(context.Context, string, *http.Header, io.Reader, interface{}) (*http.Response, error) Put(context.Context, string, *http.Header, io.Reader) (*http.Response, error) PutBody(context.Context, string, *http.Header, io.Reader) (*http.Response, []byte, error) PutJSON(context.Context, string, *http.Header, io.Reader, interface{}) (*http.Response, error) }
HTTPClient is the interface of an http client
type InteractionAutocompleteResponse ¶ added in v23.1.0
type InteractionAutocompleteResponse struct {
Choices []entity.ApplicationCommandOptionChoice `json:"choices"`
}
func (InteractionAutocompleteResponse) MarshalToJSON ¶ added in v23.1.0
func (m InteractionAutocompleteResponse) MarshalToJSON() ([]byte, error)
type InteractionCallbackMessage ¶
type InteractionCallbackMessage struct { Type InteractionCallbackType `json:"type"` Data stdjson.RawMessage `json:"data,omitempty"` }
type InteractionCallbackType ¶
type InteractionCallbackType int
const ( CallbackTypePong InteractionCallbackType = 1 CallbackTypeChannelMessage InteractionCallbackType = 4 CallbackTypeDeferredChannelMessage InteractionCallbackType = 5 CallbackTypeDeferredUpdate InteractionCallbackType = 6 CallbackTypeUpdate InteractionCallbackType = 7 CallbackTypeAutocomplete InteractionCallbackType = 8 )
type Message ¶
type Message struct { Content string `json:"content"` Tts bool `json:"tts"` ReplyTo *MessageReference `json:"message_reference,omitempty"` Flags int `json:"flags,omitempty"` }
Message is the json object that is sent to the discord api to post a plain-text message to a server
func (Message) MarshalToJSON ¶
type MessageReference ¶
type MessageWithEmbed ¶
type MessageWithEmbed struct { Content string `json:"content"` Tts bool `json:"tts"` Embeds []Embed `json:"embeds"` ReplyTo *MessageReference `json:"message_reference,omitempty"` Flags int `json:"flags,omitempty"` }
MessageWithEmbed is the json object that is sent to the discord api to post an embed message to a server
func (MessageWithEmbed) MarshalToJSON ¶
func (m MessageWithEmbed) MarshalToJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.