mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-07-01 09:06:16 +00:00
discord: Use consts for Discord constants
This commit is contained in:
parent
c880cb2fc8
commit
f5b3e3972b
|
@ -92,24 +92,24 @@ func (ch Channel) IconURLWithType(t ImageType) string {
|
||||||
type ChannelType uint8
|
type ChannelType uint8
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||||
var (
|
const (
|
||||||
// GuildText is a text channel within a server.
|
// GuildText is a text channel within a server.
|
||||||
GuildText ChannelType = 0
|
GuildText ChannelType = iota
|
||||||
// DirectMessage is a direct message between users.
|
// DirectMessage is a direct message between users.
|
||||||
DirectMessage ChannelType = 1
|
DirectMessage
|
||||||
// GuildVoice is a voice channel within a server.
|
// GuildVoice is a voice channel within a server.
|
||||||
GuildVoice ChannelType = 2
|
GuildVoice
|
||||||
// GroupDM is a direct message between multiple users.
|
// GroupDM is a direct message between multiple users.
|
||||||
GroupDM ChannelType = 3
|
GroupDM
|
||||||
// GuildCategory is an organizational category that contains up to 50
|
// GuildCategory is an organizational category that contains up to 50
|
||||||
// channels.
|
// channels.
|
||||||
GuildCategory ChannelType = 4
|
GuildCategory
|
||||||
// GuildNews is a channel that users can follow and crosspost into their
|
// GuildNews is a channel that users can follow and crosspost into their
|
||||||
// own server.
|
// own server.
|
||||||
GuildNews ChannelType = 5
|
GuildNews
|
||||||
// GuildStore is a channel in which game developers can sell their game on
|
// GuildStore is a channel in which game developers can sell their game on
|
||||||
// Discord.
|
// Discord.
|
||||||
GuildStore ChannelType = 6
|
GuildStore
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#overwrite-object
|
// https://discord.com/developers/docs/resources/channel#overwrite-object
|
||||||
|
|
|
@ -77,17 +77,18 @@ const (
|
||||||
// ExplicitFilter is the explicit content filter level of a guild.
|
// ExplicitFilter is the explicit content filter level of a guild.
|
||||||
type ExplicitFilter enum.Enum
|
type ExplicitFilter enum.Enum
|
||||||
|
|
||||||
|
// NullExplicitFilter serialized to JSON null.
|
||||||
|
// This should only be used on nullable fields.
|
||||||
|
const NullExplicitFilter ExplicitFilter = enum.Null
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
|
// https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
|
||||||
var (
|
const (
|
||||||
// NullExplicitFilter serialized to JSON null.
|
|
||||||
// This should only be used on nullable fields.
|
|
||||||
NullExplicitFilter ExplicitFilter = enum.Null
|
|
||||||
// NoContentFilter disables content filtering for the guild.
|
// NoContentFilter disables content filtering for the guild.
|
||||||
NoContentFilter ExplicitFilter = 0
|
NoContentFilter ExplicitFilter = iota
|
||||||
// MembersWithoutRoles filters only members without roles.
|
// MembersWithoutRoles filters only members without roles.
|
||||||
MembersWithoutRoles ExplicitFilter = 1
|
MembersWithoutRoles
|
||||||
// AllMembers enables content filtering for all members.
|
// AllMembers enables content filtering for all members.
|
||||||
AllMembers ExplicitFilter = 2
|
AllMembers
|
||||||
)
|
)
|
||||||
|
|
||||||
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
|
func (f *ExplicitFilter) UnmarshalJSON(b []byte) error {
|
||||||
|
@ -104,15 +105,16 @@ func (f ExplicitFilter) MarshalJSON() ([]byte, error) {
|
||||||
// Notification is the default message notification level of a guild.
|
// Notification is the default message notification level of a guild.
|
||||||
type Notification enum.Enum
|
type Notification enum.Enum
|
||||||
|
|
||||||
|
// NullNotification serialized to JSON null.
|
||||||
|
// This should only be used on nullable fields.
|
||||||
|
const NullNotification Notification = enum.Null
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
||||||
var (
|
const (
|
||||||
// NullNotification serialized to JSON null.
|
|
||||||
// This should only be used on nullable fields.
|
|
||||||
NullNotification Notification = enum.Null
|
|
||||||
// AllMessages sends notifications for all messages.
|
// AllMessages sends notifications for all messages.
|
||||||
AllMessages Notification = 0
|
AllMessages Notification = iota
|
||||||
// OnlyMentions sends notifications only on mention.
|
// OnlyMentions sends notifications only on mention.
|
||||||
OnlyMentions Notification = 1
|
OnlyMentions
|
||||||
)
|
)
|
||||||
|
|
||||||
func (n *Notification) UnmarshalJSON(b []byte) error {
|
func (n *Notification) UnmarshalJSON(b []byte) error {
|
||||||
|
@ -127,24 +129,25 @@ func (n Notification) MarshalJSON() ([]byte, error) { return enum.ToJSON(enum.En
|
||||||
// Verification is the verification level required for a guild.
|
// Verification is the verification level required for a guild.
|
||||||
type Verification enum.Enum
|
type Verification enum.Enum
|
||||||
|
|
||||||
|
// NullVerification serialized to JSON null.
|
||||||
|
// This should only be used on nullable fields.
|
||||||
|
const NullVerification Verification = enum.Null
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
// https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
||||||
var (
|
const (
|
||||||
// NullVerification serialized to JSON null.
|
|
||||||
// This should only be used on nullable fields.
|
|
||||||
NullVerification Verification = enum.Null
|
|
||||||
// NoVerification required no verification.
|
// NoVerification required no verification.
|
||||||
NoVerification Verification = 0
|
NoVerification Verification = iota
|
||||||
// LowVerification requires a verified email
|
// LowVerification requires a verified email
|
||||||
LowVerification Verification = 1
|
LowVerification
|
||||||
// MediumVerification requires the user be registered for at least 5
|
// MediumVerification requires the user be registered for at least 5
|
||||||
// minutes.
|
// minutes.
|
||||||
MediumVerification Verification = 2
|
MediumVerification
|
||||||
// HighVerification requires the member be in the server for more than 10
|
// HighVerification requires the member be in the server for more than 10
|
||||||
// minutes.
|
// minutes.
|
||||||
HighVerification Verification = 3
|
HighVerification
|
||||||
// VeryHighVerification requires the member to have a verified phone
|
// VeryHighVerification requires the member to have a verified phone
|
||||||
// number.
|
// number.
|
||||||
VeryHighVerification Verification = 4
|
VeryHighVerification
|
||||||
)
|
)
|
||||||
|
|
||||||
func (v *Verification) UnmarshalJSON(b []byte) error {
|
func (v *Verification) UnmarshalJSON(b []byte) error {
|
||||||
|
@ -169,9 +172,9 @@ const (
|
||||||
type ExpireBehavior uint8
|
type ExpireBehavior uint8
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
|
// https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
|
||||||
var (
|
const (
|
||||||
// RemoveRole removes the role of the subscriber.
|
// RemoveRole removes the role of the subscriber.
|
||||||
RemoveRole ExpireBehavior = 0
|
RemoveRole ExpireBehavior = iota
|
||||||
// Kick kicks the subscriber from the guild.
|
// Kick kicks the subscriber from the guild.
|
||||||
Kick ExpireBehavior = 1
|
Kick
|
||||||
)
|
)
|
||||||
|
|
|
@ -118,46 +118,60 @@ type MessageType uint8
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
||||||
const (
|
const (
|
||||||
DefaultMessage MessageType = 0
|
DefaultMessage MessageType = iota
|
||||||
RecipientAddMessage MessageType = 1
|
RecipientAddMessage
|
||||||
RecipientRemoveMessage MessageType = 2
|
RecipientRemoveMessage
|
||||||
CallMessage MessageType = 3
|
CallMessage
|
||||||
ChannelNameChangeMessage MessageType = 4
|
ChannelNameChangeMessage
|
||||||
ChannelIconChangeMessage MessageType = 5
|
ChannelIconChangeMessage
|
||||||
ChannelPinnedMessage MessageType = 6
|
ChannelPinnedMessage
|
||||||
GuildMemberJoinMessage MessageType = 7
|
GuildMemberJoinMessage
|
||||||
NitroBoostMessage MessageType = 8
|
NitroBoostMessage
|
||||||
NitroTier1Message MessageType = 9
|
NitroTier1Message
|
||||||
NitroTier2Message MessageType = 10
|
NitroTier2Message
|
||||||
NitroTier3Message MessageType = 11
|
NitroTier3Message
|
||||||
ChannelFollowAddMessage MessageType = 12
|
ChannelFollowAddMessage
|
||||||
GuildDiscoveryDisqualifiedMessage MessageType = 14
|
_
|
||||||
GuildDiscoveryRequalifiedMessage MessageType = 15
|
GuildDiscoveryDisqualifiedMessage
|
||||||
InlinedReplyMessage MessageType = 19
|
GuildDiscoveryRequalifiedMessage
|
||||||
ApplicationCommandMessage MessageType = 20
|
GuildDiscoveryGracePeriodInitialWarning
|
||||||
|
GuildDiscoveryGracePeriodFinalWarning
|
||||||
|
_
|
||||||
|
InlinedReplyMessage
|
||||||
|
ApplicationCommandMessage
|
||||||
)
|
)
|
||||||
|
|
||||||
type MessageFlags enum.Enum
|
type MessageFlags enum.Enum
|
||||||
|
|
||||||
|
// NullMessage is the JSON null value of MessageFlags.
|
||||||
|
const NullMessage MessageFlags = enum.Null
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
||||||
var (
|
const (
|
||||||
// NullMessage is the JSON null value of MessageFlags.
|
|
||||||
NullMessage MessageFlags = enum.Null
|
|
||||||
// CrosspostedMessage specifies whether the message has been published to
|
// CrosspostedMessage specifies whether the message has been published to
|
||||||
// subscribed channels (via Channel Following).
|
// subscribed channels (via Channel Following).
|
||||||
CrosspostedMessage MessageFlags = 1
|
CrosspostedMessage MessageFlags = 1 << iota
|
||||||
// MessageIsCrosspost specifies whether the message originated from a
|
// MessageIsCrosspost specifies whether the message originated from a
|
||||||
// message in another channel (via Channel Following).
|
// message in another channel (via Channel Following).
|
||||||
MessageIsCrosspost MessageFlags = 2
|
MessageIsCrosspost
|
||||||
// SuppressEmbeds specifies whether to not include any embeds when
|
// SuppressEmbeds specifies whether to not include any embeds when
|
||||||
// serializing the message.
|
// serializing the message.
|
||||||
SuppressEmbeds MessageFlags = 4
|
SuppressEmbeds
|
||||||
// SourceMessageDeleted specifies whether the source message for the
|
// SourceMessageDeleted specifies whether the source message for the
|
||||||
// crosspost has been deleted (via Channel Following).
|
// crosspost has been deleted (via Channel Following).
|
||||||
SourceMessageDeleted MessageFlags = 8
|
SourceMessageDeleted
|
||||||
// UrgentMessage specifies whether the message came from the urgent message
|
// UrgentMessage specifies whether the message came from the urgent message
|
||||||
// system.
|
// system.
|
||||||
UrgentMessage MessageFlags = 16
|
UrgentMessage
|
||||||
|
// MessageHasThread specifies whether the message has an associated thread
|
||||||
|
// with the same id as the message
|
||||||
|
MessageHasThread
|
||||||
|
// EphemeralMessage specifies whether the message is only visible to
|
||||||
|
// the user who invoked the Interaction
|
||||||
|
EphemeralMessage
|
||||||
|
// MessageLoading specifies whether the message is an Interaction Response
|
||||||
|
// and the bot is "thinking"
|
||||||
|
MessageLoading
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
|
// https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
|
||||||
|
|
|
@ -2,72 +2,71 @@ package discord
|
||||||
|
|
||||||
type Permissions uint64
|
type Permissions uint64
|
||||||
|
|
||||||
var (
|
const (
|
||||||
// Allows creation of instant invites
|
// Allows creation of instant invites
|
||||||
PermissionCreateInstantInvite Permissions = 1 << 0
|
PermissionCreateInstantInvite Permissions = 1 << iota
|
||||||
// Allows kicking members
|
// Allows kicking members
|
||||||
PermissionKickMembers Permissions = 1 << 1
|
PermissionKickMembers
|
||||||
// Allows banning members
|
// Allows banning members
|
||||||
PermissionBanMembers Permissions = 1 << 2
|
PermissionBanMembers
|
||||||
// Allows all permissions and bypasses channel permission overwrites
|
// Allows all permissions and bypasses channel permission overwrites
|
||||||
PermissionAdministrator Permissions = 1 << 3
|
PermissionAdministrator
|
||||||
// Allows management and editing of channels
|
// Allows management and editing of channels
|
||||||
PermissionManageChannels Permissions = 1 << 4
|
PermissionManageChannels
|
||||||
// Allows management and editing of the guild
|
// Allows management and editing of the guild
|
||||||
PermissionManageGuild Permissions = 1 << 5
|
PermissionManageGuild
|
||||||
// Allows for the addition of reactions to messages
|
// Allows for the addition of reactions to messages
|
||||||
PermissionAddReactions Permissions = 1 << 6
|
PermissionAddReactions
|
||||||
// Allows for viewing of audit logs
|
// Allows for viewing of audit logs
|
||||||
PermissionViewAuditLog Permissions = 1 << 7
|
PermissionViewAuditLog
|
||||||
// Allows for using priority speaker in a voice channel
|
// Allows for using priority speaker in a voice channel
|
||||||
PermissionPrioritySpeaker Permissions = 1 << 8
|
PermissionPrioritySpeaker
|
||||||
// Allows the user to go live
|
// Allows the user to go live
|
||||||
PermissionStream Permissions = 1 << 9
|
PermissionStream
|
||||||
// Allows guild members to view a channel, which includes reading messages
|
// Allows guild members to view a channel, which includes reading messages
|
||||||
// in text channels
|
// in text channels
|
||||||
PermissionViewChannel Permissions = 1 << 10
|
PermissionViewChannel
|
||||||
// Allows for sending messages in a channel
|
// Allows for sending messages in a channel
|
||||||
PermissionSendMessages Permissions = 1 << 11
|
PermissionSendMessages
|
||||||
// Allows for sending of /tts messages
|
// Allows for sending of /tts messages
|
||||||
PermissionSendTTSMessages Permissions = 1 << 12
|
PermissionSendTTSMessages
|
||||||
// Allows for deletion of other users messages
|
// Allows for deletion of other users messages
|
||||||
PermissionManageMessages Permissions = 1 << 13
|
PermissionManageMessages
|
||||||
// Links sent by users with this permission will be auto-embedded
|
// Links sent by users with this permission will be auto-embedded
|
||||||
PermissionEmbedLinks Permissions = 1 << 14
|
PermissionEmbedLinks
|
||||||
// Allows for uploading images and files
|
// Allows for uploading images and files
|
||||||
PermissionAttachFiles Permissions = 1 << 15
|
PermissionAttachFiles
|
||||||
// Allows for reading of message history
|
// Allows for reading of message history
|
||||||
PermissionReadMessageHistory Permissions = 1 << 16
|
PermissionReadMessageHistory
|
||||||
// Allows for using the @everyone tag to notify all users in a channel,
|
// Allows for using the @everyone tag to notify all users in a channel,
|
||||||
// and the @here tag to notify all online users in a channel
|
// and the @here tag to notify all online users in a channel
|
||||||
PermissionMentionEveryone Permissions = 1 << 17
|
PermissionMentionEveryone
|
||||||
// Allows the usage of custom emojis from other servers
|
// Allows the usage of custom emojis from other servers
|
||||||
PermissionUseExternalEmojis Permissions = 1 << 18
|
PermissionUseExternalEmojis
|
||||||
|
|
||||||
// ?
|
// ?
|
||||||
|
_
|
||||||
// Allows for joining of a voice channel
|
// Allows for joining of a voice channel
|
||||||
PermissionConnect Permissions = 1 << 20
|
PermissionConnect
|
||||||
// Allows for speaking in a voice channel
|
// Allows for speaking in a voice channel
|
||||||
PermissionSpeak Permissions = 1 << 21
|
PermissionSpeak
|
||||||
// Allows for muting members in a voice channel
|
// Allows for muting members in a voice channel
|
||||||
PermissionMuteMembers Permissions = 1 << 22
|
PermissionMuteMembers
|
||||||
// Allows for deafening of members in a voice channel
|
// Allows for deafening of members in a voice channel
|
||||||
PermissionDeafenMembers Permissions = 1 << 23
|
PermissionDeafenMembers
|
||||||
// Allows for moving of members between voice channels
|
// Allows for moving of members between voice channels
|
||||||
PermissionMoveMembers Permissions = 1 << 24
|
PermissionMoveMembers
|
||||||
// Allows for using voice-activity-detection in a voice channel
|
// Allows for using voice-activity-detection in a voice channel
|
||||||
PermissionUseVAD Permissions = 1 << 25
|
PermissionUseVAD
|
||||||
// Allows for modification of own nickname
|
// Allows for modification of own nickname
|
||||||
PermissionChangeNickname Permissions = 1 << 26
|
PermissionChangeNickname
|
||||||
// Allows for modification of other users nicknames
|
// Allows for modification of other users nicknames
|
||||||
PermissionManageNicknames Permissions = 1 << 27
|
PermissionManageNicknames
|
||||||
// Allows management and editing of roles
|
// Allows management and editing of roles
|
||||||
PermissionManageRoles Permissions = 1 << 28
|
PermissionManageRoles
|
||||||
// Allows management and editing of webhooks
|
// Allows management and editing of webhooks
|
||||||
PermissionManageWebhooks Permissions = 1 << 29
|
PermissionManageWebhooks
|
||||||
// Allows management and editing of emojis
|
// Allows management and editing of emojis
|
||||||
PermissionManageEmojis Permissions = 1 << 30
|
PermissionManageEmojis
|
||||||
|
|
||||||
PermissionAllText = 0 |
|
PermissionAllText = 0 |
|
||||||
PermissionViewChannel |
|
PermissionViewChannel |
|
||||||
|
|
Loading…
Reference in a new issue