-
Notifications
You must be signed in to change notification settings - Fork 144
Enumerations
The Discord API uses numbers to represent certain data types. For convenience, these are enumerated in Discord as special read-only tables, found in the main Discordia module. All available enumerations are listed at the end of this page.
Users are highly encouraged to use values in this page for a better code quality.
local discordia = require("discordia")
local enums = discordia.enums
Enumerations (enums) can be accessed like a regular Lua table, but they cannot be modified. This is completely optional, but it is generally easier to use and read enumerations than it is to use and read plain numbers. For example, given a text channel object, the following are logically equivalent:
if channel.type == 0 then
print("This is a text channel")
end
if channel.type == enums.channelType.text then
print("This is still a text channel!")
end
print(enums.verificationLevel.low) -- 1
Additionally, enumerations work in reverse. If you have the number, but you want to recall the human-readable version, simply call the enum; it will return a string if the enumeration is valid.
print(enums.channelType(channel.type)) -- "text"
print(enums.verificationLevel(1)) -- "low"
If necessary, custom enumerations can be written using the enum
constructor:
local fruit = enums.enum({
apple = 0,
orange = 1,
banana = 2,
cherry = 3
})
print(enums.fruit.apple) -- 0
print(enums.fruit(2)) -- "banana"
The enumerations are designed to be compatible with the Discord API. They are not necessarily unique to Discordia.
NOTE: As the Discord API and Discordia receive new features, this list of enumarations may become outdated. This list simply compiles all of the current enumerations available. The latest enumerations are available in {discordia}/libs/enums.lua
Name | Value |
---|---|
blurple | 0 |
gray | 1 |
green | 2 |
orange | 3 |
red | 4 |
Name | Value |
---|---|
allMessages | 0 |
onlyMentions | 1 |
Name | Value | Comments |
---|---|---|
text | 0 | |
private | 1 | |
voice | 2 | |
group | 3 | |
category | 4 | |
news | 5 | |
store | 6 | |
_ | 7 - 9 | Unused 🤷 |
newsThread | 10 | |
publicThread | 11 | |
privateThread | 12 | |
stageVoice | 13 | |
directory | 14 | |
forum | 15 |
Name | Value |
---|---|
incoming | 1 |
channelFollower | 2 |
application | 3 |
Name | Value | Comments |
---|---|---|
default | 0 | |
recipientAdd | 1 | |
recipientRemove | 2 | |
call | 3 | |
channelNameChange | 4 | |
channelIconchange | 5 | |
pinnedMessage | 6 | |
memberJoin | 7 | |
premiumGuildSubscription | 8 | |
premiumGuildSubscriptionTier1 | 9 | |
premiumGuildSubscriptionTier2 | 10 | |
premiumGuildSubscriptionTier3 | 11 | |
channelFollowAdd | 12 | |
guildStream | 13 | Unused 🤷 |
guildDiscoveryDisqualified | 14 | |
guildDiscoveryRequalified | 15 | |
guildDiscoveryInitialWarning | 16 | |
guildDiscoveryFinalWarning | 17 | |
threadCreated | 18 | |
reply | 19 | |
chatInputCommand | 20 | |
threadStarterMessage | 21 | |
guildInviteReminder | 22 | |
contextMenuCommand | 23 | |
autoModerationAction | 24 | |
roleSubscriptionPurchase | 25 | |
interactionPremiumUpsell | 26 | |
stageStart | 27 | |
stageEnd | 28 | |
stageSpeaker | 29 | |
stageTopic | 30 | |
applicationPremiumSubscription | 31 |
Name | Value |
---|---|
none | 0 |
friend | 1 |
blocked | 2 |
pendingIncoming | 3 |
pendingOutgoing | 4 |
implicit | 5 |
Name | Value |
---|---|
default | 0 |
streaming | 1 |
listening | 2 |
watching | 3 |
custom | 4 |
competing | 5 |
Name | Value |
---|---|
default | 0 |
streaming | 1 |
listening | 2 |
watching | 3 |
custom | 4 |
competing | 5 |
Name | Value | Comments |
---|---|---|
online | online | |
idle | idle | |
doNotDisturb | dnd | |
invisible | invisible | Only sent? 📤 |
offline | offline | Only received? 📥 |
Name | Value | Funny |
---|---|---|
none | 0 | ❌ 🔓 :( |
low | 1 | 🤔 |
medium | 2 | 😎 |
high | 3 | (╯°□°)╯︵ ┻━┻ 😍 |
veryHigh | 4 | ┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻ 🍉 |
Name | Value |
---|---|
none | 0 |
medium | 1 |
high | 2 |
Name | Value |
---|---|
none | 0 |
tier1 | 1 |
tier2 | 2 |
tier3 | 3 |
Name | Value |
---|---|
createInstantInvite | 0x1 |
kickMembers | 0x2 |
banMembers | 0x4 |
administrator | 0x8 |
manageChannels | 0x16 |
manageGuild | 0x32 |
addReactions | 0x64 |
viewAuditLog | 0x128 |
prioritySpeaker | 0x256 |
stream | 0x512 |
readMessages | 0x1024 |
sendMessages | 0x2048 |
sendTextToSpeech | 0x4096 |
manageMessages | 0x8192 |
embedLinks | 0x16384 |
attachFiles | 0x32768 |
readMessageHistory | 0x65536 |
mentionEveryone | 0x131072 |
useExternalEmojis | 0x262144 |
viewGuildInsights | 0x524288 |
connect | 0x1048576 |
speak | 0x2097152 |
muteMembers | 0x4194304 |
deafenMembers | 0x8388608 |
moveMembers | 0x16777216 |
useVoiceActivity | 0x33554432 |
changeNickname | 0x67108864 |
manageNicknames | 0x134217728 |
manageRoles | 0x268435456 |
manageWebhooks | 0x536870912 |
manageEmojis | 0x1073741824 |
useSlashCommands | 0x2147483648 |
requestToSpeak | 0x4294967296 |
manageEvents | 0x8589934592 |
manageThreads | 0x17179869184 |
usePublicThreads | 0x34359738368 |
usePrivateThreads | 0x68719476736 |
useExternalStickers | 0x137438953472 |
sendMessagesInThreads | 0x274877906944 |
useEmbeddedActivities | 0x549755813888 |
moderateMembers | 0x1099511627776 |
monetizationAnalytics | 0x2199023255552 |
useSoundboard | 0x4398046511104 |
unused | 0x17592186044416 |
useExternalSounds | 0x35184372088832 |
sendVoiceMessages | 0x70368744177664 |
Name | Value |
---|---|
crossposted | 0x1 |
isCrosspost | 0x2 |
suppressEmbeds | 0x4 |
sourceMessageDeleted | 0x8 |
urgent | 0x16 |
hasThread | 0x32 |
ephemeral | 0x64 |
loading | 0x128 |
threadFailedToMentionRoles | 0x256 |
unused | 0x2048 |
suppressNotification | 0x4096 |
isVoiceMessage | 0x8192 |
Name | Value | Comments |
---|---|---|
guilds | 0x1 | |
guildMembers | 0x2 | Privileged 🛡️ |
guildModeration | 0x4 | |
guildEmojis | 0x8 | |
guildIntegrations | 0x16 | |
guildWebhooks | 0x32 | |
guildInvites | 0x64 | |
guildVoiceStates | 0x128 | |
guildPresences | 0x256 | Privileged 🛡️ |
guildMessages | 0x512 | |
guildMessageReactions | 0x1024 | |
guildMessageTyping | 0x2048 | |
directMessage | 0x4096 | |
directMessageRections | 0x8192 | |
directMessageTyping | 0x16384 | |
messageContent | 0x32768 | Privileged 🛡️ |
guildScheduledEvents | 0x65536 | |
unused | 0x524288 | |
autoModConfiguration | 0x1048576 | |
autoModExecution | 0x2097152 |
Name | Value |
---|---|
guildUpdate | 1 |
channelCreate | 10 |
channelUpdate | 11 |
channelDelete | 12 |
channelOverwriteCreate | 13 |
channelOverwriteUpdate | 14 |
channelOverwriteDelete | 15 |
memberKick | 20 |
memberPrune | 21 |
memberBanAdd | 22 |
memberBanRemove | 23 |
memberUpdate | 24 |
memberRoleUpdate | 25 |
memberMove | 26 |
memberDisconnect | 27 |
botAdd | 28 |
roleCreate | 30 |
roleUpdate | 31 |
roleDelete | 32 |
inviteCreate | 40 |
inviteUpdate | 41 |
inviteDelete | 42 |
webhookCreate | 50 |
webhookUpdate | 51 |
webhookDelete | 52 |
emojiCreate | 60 |
emojiUpdate | 61 |
emojiDelete | 62 |
messageDelete | 72 |
messageBulkDelete | 73 |
messagePin | 74 |
messageUnpin | 75 |
integrationCreate | 80 |
integrationUpdate | 81 |
integrationDelete | 82 |
stageInstanceCreate | 83 |
stageInstanceUpdate | 84 |
stageInstanceDelete | 85 |
stickerCreate | 90 |
stickerUpdate | 91 |
stickerDelete | 92 |
eventCreate | 100 |
eventUpdate | 101 |
eventDelete | 102 |
threadCreate | 110 |
threadUpdate | 111 |
threadDelete | 112 |
autoModRuleCreate | 140 |
autoModRuleUpdate | 141 |
autoModRuleDelete | 142 |
autoModMessageBlock | 143 |
autoModMessageFlag | 144 |
autoModUserTimeout | 145 |
These enumerations are not necessarily relevant to the Discord API, but are used in Discordia in other ways.
Name | Value |
---|---|
none | 0 |
error | 1 |
warning | 2 |
info | 3 |
debug | 4 |