diff options
Diffstat (limited to 'src/discord')
-rw-r--r-- | src/discord/auditlog.hpp | 28 | ||||
-rw-r--r-- | src/discord/channel.hpp | 5 | ||||
-rw-r--r-- | src/discord/chatsubmitparams.hpp | 2 | ||||
-rw-r--r-- | src/discord/discord.cpp | 10 | ||||
-rw-r--r-- | src/discord/emoji.cpp | 4 | ||||
-rw-r--r-- | src/discord/emoji.hpp | 2 | ||||
-rw-r--r-- | src/discord/message.cpp | 2 | ||||
-rw-r--r-- | src/discord/message.hpp | 27 | ||||
-rw-r--r-- | src/discord/objects.cpp | 6 | ||||
-rw-r--r-- | src/discord/objects.hpp | 15 | ||||
-rw-r--r-- | src/discord/permissions.hpp | 175 | ||||
-rw-r--r-- | src/discord/store.cpp | 32 | ||||
-rw-r--r-- | src/discord/user.hpp | 3 |
13 files changed, 244 insertions, 67 deletions
diff --git a/src/discord/auditlog.hpp b/src/discord/auditlog.hpp index 3a902d1..5921937 100644 --- a/src/discord/auditlog.hpp +++ b/src/discord/auditlog.hpp @@ -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 { diff --git a/src/discord/channel.hpp b/src/discord/channel.hpp index df944ec..cac8b4c 100644 --- a/src/discord/channel.hpp +++ b/src/discord/channel.hpp @@ -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 { diff --git a/src/discord/chatsubmitparams.hpp b/src/discord/chatsubmitparams.hpp index e195189..45fbb2a 100644 --- a/src/discord/chatsubmitparams.hpp +++ b/src/discord/chatsubmitparams.hpp @@ -1,4 +1,5 @@ #pragma once +#include <optional> #include <vector> #include <string> #include <glibmm/ustring.h> @@ -15,6 +16,7 @@ struct ChatSubmitParams { Glib::RefPtr<Gio::File> File; AttachmentType Type; std::string Filename; + std::optional<std::string> Description; }; bool Silent = false; diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 0618e72..ac7e2f2 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -518,6 +518,7 @@ void DiscordClient::SendChatMessageAttachments(const ChatSubmitParams ¶ms, c CreateMessageObject obj; obj.Content = params.Message; obj.Nonce = nonce; + obj.Attachments.emplace(); if (params.Silent) { obj.Flags |= MessageFlags::SUPPRESS_NOTIFICATIONS; } @@ -541,11 +542,16 @@ void DiscordClient::SendChatMessageAttachments(const ChatSubmitParams ¶ms, c m_generic_dispatch.emit(); }); req.make_form(); - req.add_field("payload_json", nlohmann::json(obj).dump().c_str(), CURL_ZERO_TERMINATED); + for (size_t i = 0; i < params.Attachments.size(); i++) { + auto &attachment = params.Attachments.at(i); const auto field_name = "files[" + std::to_string(i) + "]"; - req.add_file(field_name, params.Attachments.at(i).File, params.Attachments.at(i).Filename); + req.add_file(field_name, attachment.File, attachment.Filename); + obj.Attachments->push_back({ static_cast<int>(i), attachment.Description }); } + + req.add_field("payload_json", nlohmann::json(obj).dump().c_str(), CURL_ZERO_TERMINATED); + m_http.Execute(std::move(req), [this, params, nonce, callback](const http::response_type &res) { for (const auto &attachment : params.Attachments) { if (attachment.Type == ChatSubmitParams::AttachmentType::PastedImage) { diff --git a/src/discord/emoji.cpp b/src/discord/emoji.cpp index a21b9bd..9c63558 100644 --- a/src/discord/emoji.cpp +++ b/src/discord/emoji.cpp @@ -49,3 +49,7 @@ std::string EmojiData::URLFromID(Snowflake emoji_id, const char *ext, const char std::string EmojiData::URLFromID(const Glib::ustring &emoji_id, const char *ext, const char *size) { return URLFromID(emoji_id.raw(), ext, size); } + +bool EmojiData::IsEmojiAnimated() const noexcept { + return IsAnimated.has_value() && *IsAnimated; +} diff --git a/src/discord/emoji.hpp b/src/discord/emoji.hpp index 156e127..a7b994f 100644 --- a/src/discord/emoji.hpp +++ b/src/discord/emoji.hpp @@ -22,4 +22,6 @@ struct EmojiData { static std::string URLFromID(const std::string &emoji_id, const char *ext = "png", const char *size = nullptr); static std::string URLFromID(Snowflake emoji_id, const char *ext = "png", const char *size = nullptr); static std::string URLFromID(const Glib::ustring &emoji_id, const char *ext = "png", const char *size = nullptr); + + bool IsEmojiAnimated() const noexcept; }; diff --git a/src/discord/message.cpp b/src/discord/message.cpp index bc4c6c8..8a0e271 100644 --- a/src/discord/message.cpp +++ b/src/discord/message.cpp @@ -128,6 +128,7 @@ void to_json(nlohmann::json &j, const AttachmentData &m) { j["proxy_url"] = m.ProxyURL; JS_IF("height", m.Height); JS_IF("width", m.Width); + JS_IF("description", m.Description); } void from_json(const nlohmann::json &j, AttachmentData &m) { @@ -138,6 +139,7 @@ void from_json(const nlohmann::json &j, AttachmentData &m) { JS_D("proxy_url", m.ProxyURL); JS_ON("height", m.Height); JS_ON("width", m.Width); + JS_ON("description", m.Description); } void from_json(const nlohmann::json &j, MessageReferenceData &m) { diff --git a/src/discord/message.hpp b/src/discord/message.hpp index 0f53021..1e836d0 100644 --- a/src/discord/message.hpp +++ b/src/discord/message.hpp @@ -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 { @@ -146,8 +168,9 @@ struct AttachmentData { int Bytes; std::string URL; std::string ProxyURL; - std::optional<int> Height; // null - std::optional<int> Width; // null + std::optional<int> Height; // null + std::optional<int> Width; // null + std::optional<std::string> Description; // alt text friend void to_json(nlohmann::json &j, const AttachmentData &m); friend void from_json(const nlohmann::json &j, AttachmentData &m); diff --git a/src/discord/objects.cpp b/src/discord/objects.cpp index 4ad17c3..804f10d 100644 --- a/src/discord/objects.cpp +++ b/src/discord/objects.cpp @@ -306,9 +306,15 @@ void to_json(nlohmann::json &j, const HeartbeatMessage &m) { j["d"] = m.Sequence; } +void to_json(nlohmann::json &j, const CreateMessageAttachmentObject &m) { + j["id"] = m.ID; + JS_IF("description", m.Description); +} + void to_json(nlohmann::json &j, const CreateMessageObject &m) { j["content"] = m.Content; j["flags"] = m.Flags; + JS_IF("attachments", m.Attachments); JS_IF("message_reference", m.MessageReference); JS_IF("nonce", m.Nonce); } diff --git a/src/discord/objects.hpp b/src/discord/objects.hpp index 305ac65..dfe99f0 100644 --- a/src/discord/objects.hpp +++ b/src/discord/objects.hpp @@ -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 { @@ -426,11 +433,19 @@ struct HeartbeatMessage : GatewayMessage { friend void to_json(nlohmann::json &j, const HeartbeatMessage &m); }; +struct CreateMessageAttachmentObject { + int ID; + std::optional<std::string> Description; + + friend void to_json(nlohmann::json &j, const CreateMessageAttachmentObject &m); +}; + struct CreateMessageObject { std::string Content; MessageFlags Flags = MessageFlags::NONE; std::optional<MessageReferenceData> MessageReference; std::optional<std::string> Nonce; + std::optional<std::vector<CreateMessageAttachmentObject>> Attachments; friend void to_json(nlohmann::json &j, const CreateMessageObject &m); }; diff --git a/src/discord/permissions.hpp b/src/discord/permissions.hpp index d274dd9..0d2217f 100644 --- a/src/discord/permissions.hpp +++ b/src/discord/permissions.hpp @@ -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. Present in client + CREATE_EVENTS = (1ULL << 44), // undocumented. Present in client + 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. Present in Client - ALL = 0x1FFFFFFFFFULL, + ALL = 0x1FFFFFFFFFFFFULL, }; template<> @@ -91,7 +104,7 @@ constexpr const char *GetPermissionString(Permission perm) { case Permission::STREAM: return "Video"; case Permission::VIEW_CHANNEL: - return "View Channel"; + return "View Channels"; case Permission::SEND_MESSAGES: return "Send Messages"; case Permission::SEND_TTS_MESSAGES: @@ -130,16 +143,42 @@ constexpr const char *GetPermissionString(Permission perm) { return "Manage Roles"; case Permission::MANAGE_WEBHOOKS: return "Manage Webhooks"; - case Permission::MANAGE_EMOJIS: - return "Manage Emojis"; - case Permission::USE_SLASH_COMMANDS: - return "Use Slash Commands"; + case Permission::MANAGE_GUILD_EXPRESSIONS: + return "Manage Expressions"; + case Permission::USE_APPLICATION_COMMANDS: + return "Use Application Commands"; + case Permission::MANAGE_EVENTS: + return "Manage Events"; case Permission::MANAGE_THREADS: return "Manage Threads"; - case Permission::USE_PUBLIC_THREADS: - return "Use Public Threads"; - case Permission::USE_PRIVATE_THREADS: - return "Use Private Threads"; + case Permission::CREATE_PUBLIC_THREADS: + return "Create Public Threads"; + case Permission::CREATE_PRIVATE_THREADS: + return "Create Private Threads"; + case Permission::USE_EXTERNAL_STICKERS: + return "Use External Stickers"; + case Permission::SEND_MESSAGES_IN_THREADS: + return "Send Messages In Threads"; + case Permission::USE_EMBEDDED_ACTIVITIES: + return "Use Activities"; + case Permission::MODERATE_MEMBERS: + return "Timeout Members"; + // case Permission::VIEW_CREATOR_MONETIZATION_ANALYTICS: + // return ""; + case Permission::USE_SOUNDBOARD: + return "Use Soundboard"; + case Permission::CREATE_GUILD_EXPRESSIONS: + return "Create Expressions"; + case Permission::CREATE_EVENTS: + return "Create Events"; + case Permission::USE_EXTERNAL_SOUNDS: + return "Use External Sounds"; + case Permission::SEND_VOICE_MESSAGES: + return "Send Voice Messages"; + // case Permission::USE_CLYDE_AI: + // return ""; + case Permission::SET_VOICE_CHANNEL_STATUS: + return "Set Voice Channel Status"; default: return "Unknown Permission"; } @@ -209,16 +248,42 @@ 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: - return "Allows members to add or remove custom emojis in this server."; - case Permission::USE_SLASH_COMMANDS: - return "Allows members to use slash commands in text channels."; + case Permission::MANAGE_GUILD_EXPRESSIONS: + return "Allows members to add or remove custom emoji, stickers, and sounds in this server."; + case Permission::USE_APPLICATION_COMMANDS: + return "Allows members to use commands from applications, including slash commands and context menu commands."; + case Permission::MANAGE_EVENTS: + return "Allows members to edit and cancel events."; case Permission::MANAGE_THREADS: - return "Allows members to rename, delete, archive/unarchive, and turn on slow mode for threads."; - case Permission::USE_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: - 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."; + return "Allows members to rename, delete, close, and turn on slow mode for threads. They can also view private threads"; + case Permission::CREATE_PUBLIC_THREADS: + return "Allows members to create threads that everyone in a channel can view."; + case Permission::CREATE_PRIVATE_THREADS: + return "Allows members to create invite-only threads."; + case Permission::USE_EXTERNAL_STICKERS: + return "Allows members to use stickers from other servers, if they're a Discord Nitro member."; + case Permission::SEND_MESSAGES_IN_THREADS: + return "Allows members to send messages in threads."; + case Permission::USE_EMBEDDED_ACTIVITIES: + return "Allows members to use Activities in this server."; + case Permission::MODERATE_MEMBERS: + return "When you put a user in timeout they will not be able to send messages in chat, reply within threads, react to messages, or speak in voice or Stage channels."; + // case Permission::VIEW_CREATOR_MONETIZATION_ANALYTICS: + // return ""; + case Permission::USE_SOUNDBOARD: + return "Allows members to send sounds from server soundboard."; + case Permission::CREATE_GUILD_EXPRESSIONS: + return "Allows members to add custom emoji, stickers, and sounds in this server."; + case Permission::CREATE_EVENTS: + return "Allows members to create events."; + case Permission::USE_EXTERNAL_SOUNDS: + return "Allows members to use sounds from other servers, if they're a Discord Nitro member."; + case Permission::SEND_VOICE_MESSAGES: + return "Allows members to send voice messages."; + // case Permission::USE_CLYDE_AI: + // return ""; + case Permission::SET_VOICE_CHANNEL_STATUS: + return "Allows members to create and edit voice channel status."; default: return ""; } diff --git a/src/discord/store.cpp b/src/discord/store.cpp index dfeb7d1..bf630aa 100644 --- a/src/discord/store.cpp +++ b/src/discord/store.cpp @@ -368,6 +368,7 @@ void Store::SetMessage(Snowflake id, const Message &message) { s->Bind(6, a.ProxyURL); s->Bind(7, a.Height); s->Bind(8, a.Width); + s->Bind(9, a.Description); if (!s->Insert()) fprintf(stderr, "message attachment insert failed for %" PRIu64 "/%" PRIu64 ": %s\n", static_cast<uint64_t>(id), static_cast<uint64_t>(a.ID), m_db.ErrStr()); s->Reset(); @@ -975,7 +976,7 @@ Message Store::GetMessageBound(std::unique_ptr<Statement> &s) const { s->Get(5, r.Timestamp); s->Get(6, r.EditedTimestamp); // s->Get(7, r.IsTTS); - // s->Get(8, r.DoesMentionEveryone); + s->Get(8, r.DoesMentionEveryone); s->GetJSON(9, r.Embeds); s->Get(10, r.IsPinned); s->Get(11, r.WebhookID); @@ -1021,6 +1022,7 @@ Message Store::GetMessageBound(std::unique_ptr<Statement> &s) const { s->Get(5, q.ProxyURL); s->Get(6, q.Height); s->Get(7, q.Width); + s->Get(8, q.Description); } s->Reset(); } @@ -1056,11 +1058,12 @@ Message Store::GetMessageBound(std::unique_ptr<Statement> &s) const { while (s->FetchOne()) { size_t idx; ReactionData q; - s->Get(0, q.Emoji.ID); - s->Get(1, q.Emoji.Name); - s->Get(2, q.Count); - s->Get(3, q.HasReactedWith); - s->Get(4, idx); + s->Get(0, q.Count); + s->Get(1, q.HasReactedWith); + s->Get(2, idx); + s->Get(3, q.Emoji.ID); + s->Get(4, q.Emoji.Name); + s->Get(5, q.Emoji.IsAnimated); tmp[idx] = q; } s->Reset(); @@ -1508,6 +1511,7 @@ bool Store::CreateTables() { proxy TEXT NOT NULL, height INTEGER, width INTEGER, + description TEXT, PRIMARY KEY(message, id) ) )"; @@ -2211,7 +2215,7 @@ bool Store::CreateStatements() { m_stmt_set_attachment = std::make_unique<Statement>(m_db, R"( REPLACE INTO attachments VALUES ( - ?, ?, ?, ?, ?, ?, ?, ? + ?, ?, ?, ?, ?, ?, ?, ?, ? ) )"); if (!m_stmt_set_attachment->OK()) { @@ -2291,7 +2295,19 @@ bool Store::CreateStatements() { } m_stmt_get_reactions = std::make_unique<Statement>(m_db, R"( - SELECT emoji_id, name, count, me, idx FROM reactions WHERE message = ? + SELECT + reactions.count, + reactions.me, + reactions.idx, + emojis.id, + emojis.name, + emojis.animated + FROM + reactions + INNER JOIN + emojis ON reactions.emoji_id = emojis.id + WHERE + message = ? )"); if (!m_stmt_get_reactions->OK()) { fprintf(stderr, "failed to prepare get reactions statement: %s\n", m_db.ErrStr()); diff --git a/src/discord/user.hpp b/src/discord/user.hpp index 8b2a2c4..3e356a4 100644 --- a/src/discord/user.hpp +++ b/src/discord/user.hpp @@ -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, |