mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-08-21 15:54:48 +00:00
discord: Update to match current API docs (#277)
* discord: update permission constants
* discord: update MessageType constants, add ephemeral field to Attachment
Renamed ApplicationCommandMessage to ChatInputCommandMessage and add
ContextMenuCommand. Add the ephemeral field to Attachment.
* discord: add version field to Command
* gateway: remove ApplicationCommandUpdateEvent
52f1824451
This commit is contained in:
parent
5d2d39d422
commit
e203e31ab3
|
@ -9,7 +9,7 @@ import (
|
||||||
// Command is the base "command" model that belongs to an application. This is
|
// Command is the base "command" model that belongs to an application. This is
|
||||||
// what you are creating when you POST a new command.
|
// what you are creating when you POST a new command.
|
||||||
//
|
//
|
||||||
// https://discord.com/developers/docs/interactions/slash-commands#application-command-object
|
// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure
|
||||||
type Command struct {
|
type Command struct {
|
||||||
// ID is the unique id of the command.
|
// ID is the unique id of the command.
|
||||||
ID CommandID `json:"id"`
|
ID CommandID `json:"id"`
|
||||||
|
@ -34,6 +34,9 @@ type Command struct {
|
||||||
// NoDefaultPermissions defines whether the command is NOT enabled by
|
// NoDefaultPermissions defines whether the command is NOT enabled by
|
||||||
// default when the app is added to a guild.
|
// default when the app is added to a guild.
|
||||||
NoDefaultPermission bool `json:"-"`
|
NoDefaultPermission bool `json:"-"`
|
||||||
|
// Version is an autoincrementing version identifier updated during
|
||||||
|
// substantial record changes
|
||||||
|
Version Snowflake `json:"version,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommandType uint
|
type CommandType uint
|
||||||
|
|
|
@ -147,13 +147,14 @@ const (
|
||||||
// name of the thread.
|
// name of the thread.
|
||||||
ThreadCreatedMessage
|
ThreadCreatedMessage
|
||||||
InlinedReplyMessage
|
InlinedReplyMessage
|
||||||
ApplicationCommandMessage
|
ChatInputCommandMessage
|
||||||
// ThreadStarterMessage is a new message sent as the first message in
|
// ThreadStarterMessage is a new message sent as the first message in
|
||||||
// threads that are started from an existing message in the parent channel.
|
// threads that are started from an existing message in the parent channel.
|
||||||
// It only contains a message reference field that points to the message
|
// It only contains a message reference field that points to the message
|
||||||
// from which the thread was started.
|
// from which the thread was started.
|
||||||
ThreadStarterMessage
|
ThreadStarterMessage
|
||||||
GuildInviteReminderMessage
|
GuildInviteReminderMessage
|
||||||
|
ContextMenuCommand
|
||||||
)
|
)
|
||||||
|
|
||||||
type MessageFlags enum.Enum
|
type MessageFlags enum.Enum
|
||||||
|
@ -371,6 +372,11 @@ type Attachment struct {
|
||||||
Height uint `json:"height,omitempty"`
|
Height uint `json:"height,omitempty"`
|
||||||
// Width is the width of the file, if it is an image.
|
// Width is the width of the file, if it is an image.
|
||||||
Width uint `json:"width,omitempty"`
|
Width uint `json:"width,omitempty"`
|
||||||
|
// Ephemeral is whether this attachment is ephemeral. Ephemeral attachments
|
||||||
|
// will automatically be removed after a set period of time. Ephemeral
|
||||||
|
// attachments on messages are guaranteed to be available as long as
|
||||||
|
// the message itself exists.
|
||||||
|
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -78,11 +78,16 @@ const (
|
||||||
// threads
|
// threads
|
||||||
PermissionManageThreads
|
PermissionManageThreads
|
||||||
// Allows for creating and participating in threads.
|
// Allows for creating and participating in threads.
|
||||||
PermissionUsePublicThreads
|
PermissionCreatePublicThreads
|
||||||
// Allows for creating and participating in private threads.
|
// Allows for creating and participating in private threads.
|
||||||
PermissionUsePrivateThreads
|
PermissionCreatePrivateThreads
|
||||||
// Allows the usage of custom stickers from other servers
|
// Allows the usage of custom stickers from other servers
|
||||||
PermissionUseExternalStickers
|
PermissionUseExternalStickers
|
||||||
|
// Allows for sending messages in threads
|
||||||
|
PermissionSendMessagesInThreads
|
||||||
|
// Allows for launching activities (applications with the EMBEDDED flag)
|
||||||
|
// in a voice channel
|
||||||
|
PermissionStartEmbeddedActivities
|
||||||
|
|
||||||
PermissionAllText = 0 |
|
PermissionAllText = 0 |
|
||||||
PermissionViewChannel |
|
PermissionViewChannel |
|
||||||
|
@ -95,9 +100,12 @@ const (
|
||||||
PermissionMentionEveryone |
|
PermissionMentionEveryone |
|
||||||
PermissionUseExternalEmojis |
|
PermissionUseExternalEmojis |
|
||||||
PermissionUseSlashCommands |
|
PermissionUseSlashCommands |
|
||||||
PermissionUsePublicThreads |
|
PermissionManageThreads |
|
||||||
PermissionUsePrivateThreads |
|
PermissionCreatePublicThreads |
|
||||||
PermissionUseExternalStickers
|
PermissionCreatePrivateThreads |
|
||||||
|
PermissionUseExternalStickers |
|
||||||
|
PermissionAddReactions |
|
||||||
|
PermissionSendMessagesInThreads
|
||||||
|
|
||||||
PermissionAllVoice = 0 |
|
PermissionAllVoice = 0 |
|
||||||
PermissionViewChannel |
|
PermissionViewChannel |
|
||||||
|
@ -109,16 +117,15 @@ const (
|
||||||
PermissionMoveMembers |
|
PermissionMoveMembers |
|
||||||
PermissionUseVAD |
|
PermissionUseVAD |
|
||||||
PermissionPrioritySpeaker |
|
PermissionPrioritySpeaker |
|
||||||
PermissionRequestToSpeak
|
PermissionRequestToSpeak |
|
||||||
|
PermissionStartEmbeddedActivities
|
||||||
|
|
||||||
PermissionAllChannel = 0 |
|
PermissionAllChannel = 0 |
|
||||||
PermissionAllText |
|
PermissionAllText |
|
||||||
PermissionAllVoice |
|
PermissionAllVoice |
|
||||||
PermissionCreateInstantInvite |
|
PermissionCreateInstantInvite |
|
||||||
PermissionManageRoles |
|
PermissionManageRoles |
|
||||||
PermissionManageChannels |
|
PermissionManageChannels
|
||||||
PermissionAddReactions |
|
|
||||||
PermissionViewAuditLog
|
|
||||||
|
|
||||||
PermissionAll = 0 |
|
PermissionAll = 0 |
|
||||||
PermissionAllChannel |
|
PermissionAllChannel |
|
||||||
|
@ -130,7 +137,7 @@ const (
|
||||||
PermissionManageEmojisAndStickers |
|
PermissionManageEmojisAndStickers |
|
||||||
PermissionManageNicknames |
|
PermissionManageNicknames |
|
||||||
PermissionChangeNickname |
|
PermissionChangeNickname |
|
||||||
PermissionManageThreads
|
PermissionViewAuditLog
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p Permissions) Has(perm Permissions) bool {
|
func (p Permissions) Has(perm Permissions) bool {
|
||||||
|
|
|
@ -420,10 +420,3 @@ type (
|
||||||
discord.Relationship
|
discord.Relationship
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
|
||||||
ApplicationCommandUpdateEvent struct {
|
|
||||||
discord.Command
|
|
||||||
GuildID discord.GuildID `json:"guild_id"`
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
|
@ -73,6 +73,4 @@ var EventCreator = map[string]func() Event{
|
||||||
|
|
||||||
"RELATIONSHIP_ADD": func() Event { return new(RelationshipAddEvent) },
|
"RELATIONSHIP_ADD": func() Event { return new(RelationshipAddEvent) },
|
||||||
"RELATIONSHIP_REMOVE": func() Event { return new(RelationshipRemoveEvent) },
|
"RELATIONSHIP_REMOVE": func() Event { return new(RelationshipRemoveEvent) },
|
||||||
|
|
||||||
"APPLICATION_COMMAND_UPDATE": func() Event { return new(ApplicationCommandUpdateEvent) },
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue