allow using animated emojis + emojis from other servers w/ nitro

also hide unavailable emojis and role-locked emojis. if you have the role it still wont show up yet though
This commit is contained in:
ouwou
2021-04-05 02:18:30 -04:00
parent fa0e95f68c
commit 08d604f836
5 changed files with 84 additions and 36 deletions

View File

@@ -1617,6 +1617,13 @@ std::set<Snowflake> DiscordClient::GetPrivateChannels() const {
return ret;
}
PremiumType DiscordClient::GetSelfPremiumType() const {
const auto &data = GetUserData();
if (data.PremiumType.has_value())
return *data.PremiumType;
return PremiumType::None;
}
void DiscordClient::HeartbeatThread() {
while (m_client_connected) {
if (!m_heartbeat_acked) {

View File

@@ -75,6 +75,8 @@ public:
std::set<Snowflake> GetMessagesForChannel(Snowflake id) const;
std::set<Snowflake> GetPrivateChannels() const;
PremiumType GetSelfPremiumType() const;
void FetchMessagesInChannel(Snowflake id, std::function<void(const std::vector<Snowflake> &)> cb);
void FetchMessagesInChannelBefore(Snowflake channel_id, Snowflake before_id, std::function<void(const std::vector<Snowflake> &)> cb);
std::optional<Message> GetMessage(Snowflake id) const;

View File

@@ -3,6 +3,12 @@
#include "json.hpp"
#include <string>
enum class PremiumType {
None = 0,
NitroClassic = 1,
Nitro = 2,
};
struct UserData {
enum {
DiscordEmployee = 1 << 0,
@@ -36,7 +42,7 @@ struct UserData {
std::optional<bool> IsVerified;
std::optional<std::string> Email; // null
std::optional<uint64_t> Flags;
std::optional<int> PremiumType; // null
std::optional<PremiumType> PremiumType; // null
std::optional<uint64_t> PublicFlags;
// undocumented (opt)