update enums

This commit is contained in:
ouwou 2023-11-03 01:59:59 -04:00
parent cdc4a303af
commit 61cd7016fa
8 changed files with 130 additions and 52 deletions

View File

@ -49,6 +49,34 @@ enum class AuditLogActionType {
THREAD_CREATE = 110,
THREAD_UPDATE = 111,
THREAD_DELETE = 112,
// Unhandled:
APPLICATION_COMMAND_PERMISSION_UPDATE = 121,
SOUNDBOARD_SOUND_CREATE = 130,
SOUNDBOARD_SOUND_UPDATE = 131,
SOUNDBOARD_SOUND_DELETE = 132,
AUTO_MODERATION_RULE_CREATE = 140,
AUTO_MODERATION_RULE_UPDATE = 141,
AUTO_MODERATION_RULE_DELETE = 142,
AUTO_MODERATION_BLOCK_MESSAGE = 143,
AUTO_MODERATION_FLAG_TO_CHANNEL = 144,
AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145,
AUTO_MODERATION_QUARANTINE_USER = 146,
CREATOR_MONETIZATION_REQUEST_CREATED = 150,
CREATOR_MONETIZATION_TERMS_ACCEPTED = 151,
ONBOARDING_PROMPT_CREATE = 163,
ONBOARDING_PROMPT_UPDATE = 164,
ONBOARDING_PROMPT_DELETE = 165,
ONBOARDING_CREATE = 166,
ONBOARDING_UPDATE = 167,
GUILD_HOME_FEATURE_ITEM = 171,
GUILD_HOME_REMOVE_ITEM = 172,
HARMFUL_LINKS_BLOCKED_MESSAGE = 180,
HOME_SETTINGS_CREATE = 190,
HOME_SETTINGS_UPDATE = 191,
VOICE_CHANNEL_STATUS_CREATE = 192,
VOICE_CHANNEL_STATUS_DELETE = 193,
CLYDE_AI_PROFILE_UPDATE = 194
};
struct AuditLogChange {

View File

@ -20,6 +20,11 @@ enum class ChannelType : int {
GUILD_PUBLIC_THREAD = 11,
GUILD_PRIVATE_THREAD = 12,
GUILD_STAGE_VOICE = 13,
// Unimplemented:
GUILD_DIRECTORY = 14,
GUILD_FORUM = 15,
GUILD_MEDIA = 16,
};
enum class StagePrivacy {

View File

@ -33,6 +33,28 @@ enum class MessageType {
INLINE_REPLY = 19, // yep
APPLICATION_COMMAND = 20, // yep
THREAD_STARTER_MESSAGE = 21, // nope
GUILD_INVITE_REMINDER = 22, // nope
CONTEXT_MENU_COMMAND = 23, // nope
AUTO_MODERATION_ACTION = 24, // nope
ROLE_SUBSCRIPTION_PURCHASE = 25, // nope
INTERACTION_PREMIUM_UPSELL = 26, // nope
STAGE_START = 27, // nope
STAGE_END = 28, // nope
STAGE_SPEAKER = 29, // nope
STAGE_TOPIC = 31, // nope
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION = 32, // nope
PRIVATE_CHANNEL_INTEGRATION_ADDED = 33, // nope
PRIVATE_CHANNEL_INTEGRATION_REMOVED = 34, // nope
PREMIUM_REFERRAL = 35, // nope
GUILD_INCIDENT_ALERT_MODE_ENABLED = 36, // nope
GUILD_INCIDENT_ALERT_MODE_DISABLED = 37, // nope
GUILD_INCIDENT_REPORT_RAID = 38, // nope
GUILD_INCIDENT_REPORT_FALSE_ALARM = 39, // nope
GUILD_DEADCHAT_REVIVE_PROMPT = 40, // nope
CUSTOM_GIFT = 41, // nope
GUILD_GAMING_STATS_PROMPT = 42, // nope
POLL = 43, // nope
PURCHASE_NOTIFICATION = 44, // nope
};
enum class MessageFlags {

View File

@ -53,6 +53,13 @@ enum class GatewayOp : int {
EmbeddedActivityClose = 26,
EmbeddedActivityUpdate = 27,
RequestForumUnreads = 28,
RemoteCommand = 29,
GetDeletedEntityIDsNotMatchingHash = 30,
RequestSoundboardSounds = 31,
SpeedTestCreate = 32,
SpeedTestDelete = 33,
RequestLastMessages = 34,
SearchRecentMembers = 35,
};
enum class GatewayEvent : int {

View File

@ -7,44 +7,57 @@
constexpr static uint64_t PERMISSION_MAX_BIT = 36;
enum class Permission : uint64_t {
NONE = 0,
CREATE_INSTANT_INVITE = (1ULL << 0), // Allows creation of instant invites
KICK_MEMBERS = (1ULL << 1), // Allows kicking members
BAN_MEMBERS = (1ULL << 2), // Allows banning members
ADMINISTRATOR = (1ULL << 3), // Allows all permissions and bypasses channel permission overwrites
MANAGE_CHANNELS = (1ULL << 4), // Allows management and editing of channels
MANAGE_GUILD = (1ULL << 5), // Allows management and editing of the guild
ADD_REACTIONS = (1ULL << 6), // Allows for the addition of reactions to messages
VIEW_AUDIT_LOG = (1ULL << 7), // Allows for viewing of audit logs
PRIORITY_SPEAKER = (1ULL << 8), // Allows for using priority speaker in a voice channel
STREAM = (1ULL << 9), // Allows the user to go live
VIEW_CHANNEL = (1ULL << 10), // Allows guild members to view a channel, which includes reading messages in text channels
SEND_MESSAGES = (1ULL << 11), // Allows for sending messages in a channel
SEND_TTS_MESSAGES = (1ULL << 12), // Allows for sending of /tts messages
MANAGE_MESSAGES = (1ULL << 13), // Allows for deletion of other users messages
EMBED_LINKS = (1ULL << 14), // Links sent by users with this permission will be auto-embedded
ATTACH_FILES = (1ULL << 15), // Allows for uploading images and files
READ_MESSAGE_HISTORY = (1ULL << 16), // Allows for reading of message history
MENTION_EVERYONE = (1ULL << 17), // 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
USE_EXTERNAL_EMOJIS = (1ULL << 18), // Allows the usage of custom emojis from other servers
VIEW_GUILD_INSIGHTS = (1ULL << 19), // Allows for viewing guild insights
CONNECT = (1ULL << 20), // Allows for joining of a voice channel
SPEAK = (1ULL << 21), // Allows for speaking in a voice channel
MUTE_MEMBERS = (1ULL << 22), // Allows for muting members in a voice channel
DEAFEN_MEMBERS = (1ULL << 23), // Allows for deafening of members in a voice channel
MOVE_MEMBERS = (1ULL << 24), // Allows for moving of members between voice channels
USE_VAD = (1ULL << 25), // Allows for using voice-activity-detection in a voice channel
CHANGE_NICKNAME = (1ULL << 26), // Allows for modification of own nickname
MANAGE_NICKNAMES = (1ULL << 27), // Allows for modification of other users nicknames
MANAGE_ROLES = (1ULL << 28), // Allows management and editing of roles
MANAGE_WEBHOOKS = (1ULL << 29), // Allows management and editing of webhooks
MANAGE_EMOJIS = (1ULL << 30), // Allows management and editing of emojis
USE_SLASH_COMMANDS = (1ULL << 31), // Allows members to use slash commands in text channels
REQUEST_TO_SPEAK = (1ULL << 32), // Allows for requesting to speak in stage channels
MANAGE_THREADS = (1ULL << 34), // Allows for deleting and archiving threads, and viewing all private threads
USE_PUBLIC_THREADS = (1ULL << 35), // Allows for creating and participating in threads
USE_PRIVATE_THREADS = (1ULL << 36), // Allows for creating and participating in private threads
CREATE_INSTANT_INVITE = (1ULL << 0), // Allows creation of instant invites
KICK_MEMBERS = (1ULL << 1), // Allows kicking members
BAN_MEMBERS = (1ULL << 2), // Allows banning members
ADMINISTRATOR = (1ULL << 3), // Allows all permissions and bypasses channel permission overwrites
MANAGE_CHANNELS = (1ULL << 4), // Allows management and editing of channels
MANAGE_GUILD = (1ULL << 5), // Allows management and editing of the guild
ADD_REACTIONS = (1ULL << 6), // Allows for the addition of reactions to messages
VIEW_AUDIT_LOG = (1ULL << 7), // Allows for viewing of audit logs
PRIORITY_SPEAKER = (1ULL << 8), // Allows for using priority speaker in a voice channel
STREAM = (1ULL << 9), // Allows the user to go live
VIEW_CHANNEL = (1ULL << 10), // Allows guild members to view a channel, which includes reading messages in text channels
SEND_MESSAGES = (1ULL << 11), // Allows for sending messages in a channel
SEND_TTS_MESSAGES = (1ULL << 12), // Allows for sending of /tts messages
MANAGE_MESSAGES = (1ULL << 13), // Allows for deletion of other users messages
EMBED_LINKS = (1ULL << 14), // Links sent by users with this permission will be auto-embedded
ATTACH_FILES = (1ULL << 15), // Allows for uploading images and files
READ_MESSAGE_HISTORY = (1ULL << 16), // Allows for reading of message history
MENTION_EVERYONE = (1ULL << 17), // 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
USE_EXTERNAL_EMOJIS = (1ULL << 18), // Allows the usage of custom emojis from other servers
VIEW_GUILD_INSIGHTS = (1ULL << 19), // Allows for viewing guild insights
CONNECT = (1ULL << 20), // Allows for joining of a voice channel
SPEAK = (1ULL << 21), // Allows for speaking in a voice channel
MUTE_MEMBERS = (1ULL << 22), // Allows for muting members in a voice channel
DEAFEN_MEMBERS = (1ULL << 23), // Allows for deafening of members in a voice channel
MOVE_MEMBERS = (1ULL << 24), // Allows for moving of members between voice channels
USE_VAD = (1ULL << 25), // Allows for using voice-activity-detection in a voice channel
CHANGE_NICKNAME = (1ULL << 26), // Allows for modification of own nickname
MANAGE_NICKNAMES = (1ULL << 27), // Allows for modification of other users nicknames
MANAGE_ROLES = (1ULL << 28), // Allows management and editing of roles
MANAGE_WEBHOOKS = (1ULL << 29), // Allows management and editing of webhooks
MANAGE_GUILD_EXPRESSIONS = (1ULL << 30), // Allows management and editing of emojis, stickers, and soundboard sounds
USE_APPLICATION_COMMANDS = (1ULL << 31), // Allows members to use application commands, including slash commands and context menu commands
REQUEST_TO_SPEAK = (1ULL << 32), // Allows for requesting to speak in stage channels
MANAGE_EVENTS = (1ULL << 33), // Allows for creating, editing, and deleting scheduled events
MANAGE_THREADS = (1ULL << 34), // Allows for deleting and archiving threads, and viewing all private threads
CREATE_PUBLIC_THREADS = (1ULL << 35), // Allows for creating public and announcement threads
CREATE_PRIVATE_THREADS = (1ULL << 36), // Allows for creating private threads
USE_EXTERNAL_STICKERS = (1ULL << 37), // Allows the usage of custom stickers from other servers
SEND_MESSAGES_IN_THREADS = (1ULL << 38), // Allows for sending messages in threads
USE_EMBEDDED_ACTIVITIES = (1ULL << 39), // Allows for using Activities (applications with the EMBEDDED flag) in a voice channel
MODERATE_MEMBERS = (1ULL << 40), // Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels
VIEW_CREATOR_MONETIZATION_ANALYTICS = (1ULL << 41), // Allows for viewing role subscription insights
USE_SOUNDBOARD = (1ULL << 42), // Allows for using soundboard in a voice channel
CREATE_GUILD_EXPRESSIONS = (1ULL << 43), // undocumented
CREATE_EVENTS = (1ULL << 44), // undocumented
USE_EXTERNAL_SOUNDS = (1ULL << 45), // Allows the usage of custom soundboard sounds from other servers
SEND_VOICE_MESSAGES = (1ULL << 46), // Allows sending voice messages
USE_CLYDE_AI = (1ULL << 47), // undocumented
SET_VOICE_CHANNEL_STATUS = (1ULL << 48), // undocumented
ALL = 0x1FFFFFFFFFULL,
ALL = 0x1FFFFFFFFFFFFULL,
};
template<>
@ -130,15 +143,15 @@ constexpr const char *GetPermissionString(Permission perm) {
return "Manage Roles";
case Permission::MANAGE_WEBHOOKS:
return "Manage Webhooks";
case Permission::MANAGE_EMOJIS:
case Permission::MANAGE_GUILD_EXPRESSIONS:
return "Manage Emojis";
case Permission::USE_SLASH_COMMANDS:
case Permission::USE_APPLICATION_COMMANDS:
return "Use Slash Commands";
case Permission::MANAGE_THREADS:
return "Manage Threads";
case Permission::USE_PUBLIC_THREADS:
case Permission::CREATE_PUBLIC_THREADS:
return "Use Public Threads";
case Permission::USE_PRIVATE_THREADS:
case Permission::CREATE_PRIVATE_THREADS:
return "Use Private Threads";
default:
return "Unknown Permission";
@ -209,15 +222,15 @@ constexpr const char *GetPermissionDescription(Permission perm) {
return "Allows members to create new roles and edit or delete roles lower than their highest role. Also allows members to change permissions of individual channels that they have access to.";
case Permission::MANAGE_WEBHOOKS:
return "Allows members to create, edit, or delete webhooks, which can post messages from other apps or sites into this server.";
case Permission::MANAGE_EMOJIS:
case Permission::MANAGE_GUILD_EXPRESSIONS:
return "Allows members to add or remove custom emojis in this server.";
case Permission::USE_SLASH_COMMANDS:
case Permission::USE_APPLICATION_COMMANDS:
return "Allows members to use slash commands in text channels.";
case Permission::MANAGE_THREADS:
return "Allows members to rename, delete, archive/unarchive, and turn on slow mode for threads.";
case Permission::USE_PUBLIC_THREADS:
case Permission::CREATE_PUBLIC_THREADS:
return "Allows members to talk in threads. The \"Send Messages\" permission must be enabled for members to start new threads; if it's disabled, they can only respond to existing threads.";
case Permission::USE_PRIVATE_THREADS:
case Permission::CREATE_PRIVATE_THREADS:
return "Allows members to create and chat in private threads. The \"Send Messages\" permission must be enabled for members to start new private threads; if it's disabled, they can only respond to private threads they're added to.";
default:
return "";

View File

@ -7,9 +7,11 @@ enum class EPremiumType {
None = 0,
NitroClassic = 1,
Nitro = 2,
Basic = 3,
};
struct UserData {
// todo: enum class? (for consistencys sake)
enum {
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
@ -29,6 +31,7 @@ struct UserData {
Spammer = 1 << 20,
DisablePremium = 1 << 21,
ActiveDeveloper = 1 << 22,
ApplicationCommandBadge = 1 << 23,
Quarantined = 1ULL << 44,
MaxFlag_PlusOne,

View File

@ -34,7 +34,7 @@ GuildSettingsEmojisPane::GuildSettingsEmojisPane(Snowflake guild_id)
discord.signal_guild_emojis_update().connect(sigc::hide<0>(sigc::mem_fun(*this, &GuildSettingsEmojisPane::OnFetchEmojis)));
const auto self_id = discord.GetUserData().ID;
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_EMOJIS);
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_GUILD_EXPRESSIONS);
m_menu_delete.set_sensitive(can_manage);
m_search.set_placeholder_text("Filter");
@ -104,7 +104,7 @@ void GuildSettingsEmojisPane::OnMap() {
auto &discord = Abaddon::Get().GetDiscordClient();
const auto self_id = discord.GetUserData().ID;
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_EMOJIS);
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_GUILD_EXPRESSIONS);
m_menu_delete.set_sensitive(can_manage);
discord.FetchGuildEmojis(GuildID, sigc::mem_fun(*this, &GuildSettingsEmojisPane::OnFetchEmojis));
@ -228,7 +228,7 @@ bool GuildSettingsEmojisPane::OnTreeButtonPress(GdkEventButton *event) {
if (event->button == GDK_BUTTON_SECONDARY) {
auto &discord = Abaddon::Get().GetDiscordClient();
const auto self_id = discord.GetUserData().ID;
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_EMOJIS);
const bool can_manage = discord.HasGuildPermission(self_id, GuildID, Permission::MANAGE_GUILD_EXPRESSIONS);
m_menu_delete.set_sensitive(can_manage);
auto selection = m_view.get_selection();

View File

@ -262,7 +262,7 @@ GuildSettingsRolesPaneInfo::GuildSettingsRolesPaneInfo(Snowflake guild_id)
Permission::VIEW_CHANNEL,
Permission::MANAGE_CHANNELS,
Permission::MANAGE_ROLES,
Permission::MANAGE_EMOJIS,
Permission::MANAGE_GUILD_EXPRESSIONS,
Permission::VIEW_AUDIT_LOG,
Permission::VIEW_GUILD_INSIGHTS,
Permission::MANAGE_WEBHOOKS,
@ -277,8 +277,8 @@ GuildSettingsRolesPaneInfo::GuildSettingsRolesPaneInfo(Snowflake guild_id)
add_perms("Text Channels", RIGHT, {
Permission::SEND_MESSAGES,
Permission::USE_PUBLIC_THREADS,
Permission::USE_PRIVATE_THREADS,
Permission::CREATE_PUBLIC_THREADS,
Permission::CREATE_PRIVATE_THREADS,
Permission::EMBED_LINKS,
Permission::ATTACH_FILES,
Permission::ADD_REACTIONS,
@ -288,7 +288,7 @@ GuildSettingsRolesPaneInfo::GuildSettingsRolesPaneInfo(Snowflake guild_id)
Permission::MANAGE_THREADS,
Permission::READ_MESSAGE_HISTORY,
Permission::SEND_TTS_MESSAGES,
Permission::USE_SLASH_COMMANDS });
Permission::USE_APPLICATION_COMMANDS });
add_perms("Voice Channels", RIGHT, {
Permission::CONNECT,