package api import ( "encoding/json" "github.com/diamondburned/arikawa/v3/discord" "github.com/diamondburned/arikawa/v3/utils/httputil" ) var EndpointApplications = Endpoint + "applications/" // CurrentApplication returns the current bot account's Discord application. It // can be used to get the application ID. func (c *Client) CurrentApplication() (*discord.Application, error) { var app *discord.Application return app, c.RequestJSON( &app, "GET", Endpoint+"/oauth2/applications/@me", ) } // https://discord.com/developers/docs/interactions/application-commands#create-global-application-command // https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands type CreateCommandData struct { ID discord.CommandID `json:"id,omitempty"` Name string `json:"name"` NameLocalizations discord.StringLocales `json:"name_localizations,omitempty"` Description string `json:"description"` DescriptionLocalizations discord.StringLocales `json:"description_localizations,omitempty"` Options discord.CommandOptions `json:"options,omitempty"` DefaultMemberPermissions *discord.Permissions `json:"default_member_permissions,string,omitempty"` NoDMPermission bool `json:"-"` NoDefaultPermission bool `json:"-"` Type discord.CommandType `json:"type,omitempty"` } func (c CreateCommandData) MarshalJSON() ([]byte, error) { type RawCreateCommandData CreateCommandData cmd := struct { RawCreateCommandData DMPermission bool `json:"dm_permission"` DefaultPermission bool `json:"default_permission"` }{RawCreateCommandData: (RawCreateCommandData)(c)} // Discord defaults default_permission to true, so we need to invert the // meaning of the field (>NoNo