forked from OpenGamers/abaddon
Merge branch 'master' into mobile
This commit is contained in:
@@ -60,7 +60,7 @@ ChatMessageItemContainer *ChatMessageItemContainer::FromMessage(Snowflake id) {
|
||||
container->m_main->add(*container->m_text_component);
|
||||
}
|
||||
|
||||
if (data->MessageReference.has_value() || data->Interaction.has_value()) {
|
||||
if ((data->MessageReference.has_value() || data->Interaction.has_value()) && data->Type != MessageType::CHANNEL_FOLLOW_ADD) {
|
||||
auto *widget = container->CreateReplyComponent(*data);
|
||||
container->m_main->add(*widget);
|
||||
container->m_main->child_property_position(*widget) = 0; // eek
|
||||
@@ -254,6 +254,29 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) {
|
||||
else
|
||||
b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->Username + "</span> removed <span color='#eeeeee'>" + added.Username + "</span></span></i>");
|
||||
} break;
|
||||
case MessageType::CHANNEL_NAME_CHANGE: {
|
||||
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
|
||||
b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " changed the name to <b>" + Glib::Markup::escape_text(data->Content) + "</b></span></i>");
|
||||
} break;
|
||||
case MessageType::CHANNEL_ICON_CHANGE: {
|
||||
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
|
||||
b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " changed the channel icon</span></i>");
|
||||
} break;
|
||||
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1:
|
||||
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2:
|
||||
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3: {
|
||||
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
|
||||
const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(*data->GuildID);
|
||||
b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " just boosted the server <b>" + Glib::Markup::escape_text(data->Content) + "</b> times! " +
|
||||
Glib::Markup::escape_text(guild->Name) + " has achieved <b>Level " + std::to_string(static_cast<int>(data->Type) - 8) + "!</b></span></i>"); // oo cheeky me !!!
|
||||
} break;
|
||||
case MessageType::CHANNEL_FOLLOW_ADD: {
|
||||
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
|
||||
b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " has added <b>" + Glib::Markup::escape_text(data->Content) + "</b> to this channel. Its most important updates will show up here.</span></i>");
|
||||
} break;
|
||||
case MessageType::CALL: {
|
||||
b->insert_markup(s, "<span color='#999999'><i>[started a call]</i></span>");
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1667,6 +1667,7 @@ void DiscordClient::SendIdentify() {
|
||||
msg.Properties.OS = "Windows";
|
||||
msg.Properties.Browser = "";
|
||||
msg.Properties.Device = "Chrome";
|
||||
msg.Properties.SystemLocale = "en-US";
|
||||
msg.Properties.BrowserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36";
|
||||
msg.Properties.BrowserVersion = "67.0.3396.87";
|
||||
msg.Properties.OSVersion = "10";
|
||||
@@ -1675,7 +1676,7 @@ void DiscordClient::SendIdentify() {
|
||||
msg.Properties.ReferrerCurrent = "";
|
||||
msg.Properties.ReferringDomainCurrent = "";
|
||||
msg.Properties.ReleaseChannel = "stable";
|
||||
msg.Properties.ClientBuildNumber = 73785;
|
||||
msg.Properties.ClientBuildNumber = 82826;
|
||||
msg.Properties.ClientEventSource = "";
|
||||
msg.Presence.Status = "online";
|
||||
msg.Presence.Since = 0;
|
||||
|
||||
@@ -50,8 +50,8 @@ class DiscordClient {
|
||||
friend class Abaddon;
|
||||
|
||||
public:
|
||||
static const constexpr char *DiscordGateway = "wss://gateway.discord.gg/?v=8&encoding=json&compress=zlib-stream";
|
||||
static const constexpr char *DiscordAPI = "https://discord.com/api/v8";
|
||||
static const constexpr char *DiscordGateway = "wss://gateway.discord.gg/?v=9&encoding=json&compress=zlib-stream";
|
||||
static const constexpr char *DiscordAPI = "https://discord.com/api/v9";
|
||||
|
||||
public:
|
||||
DiscordClient(bool mem_store = false);
|
||||
|
||||
@@ -13,16 +13,16 @@ enum class MessageType {
|
||||
DEFAULT = 0, // yep
|
||||
RECIPIENT_ADD = 1, // yep
|
||||
RECIPIENT_REMOVE = 2, // yep
|
||||
CALL = 3, // nope
|
||||
CHANNEL_NAME_CHANGE = 4, // nope
|
||||
CHANNEL_ICON_CHANGE = 5, // nope
|
||||
CALL = 3, // yep (sorta)
|
||||
CHANNEL_NAME_CHANGE = 4, // yep
|
||||
CHANNEL_ICON_CHANGE = 5, // yep
|
||||
CHANNEL_PINNED_MESSAGE = 6, // yep
|
||||
GUILD_MEMBER_JOIN = 7, // yep
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION = 8, // nope
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, // nope
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, // nope
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, // nope
|
||||
CHANNEL_FOLLOW_ADD = 12, // nope
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION = 8, // yep
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, // yep
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, // yep
|
||||
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, // yep
|
||||
CHANNEL_FOLLOW_ADD = 12, // yep
|
||||
GUILD_DISCOVERY_DISQUALIFIED = 14, // nope
|
||||
GUILD_DISCOVERY_REQUALIFIED = 15, // nope
|
||||
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16, // nope
|
||||
@@ -40,7 +40,7 @@ enum class MessageFlags {
|
||||
SUPPRESS_EMBEDS = 1 << 2, // do not include any embeds when serializing this message
|
||||
SOURCE_MESSAGE_DELETE = 1 << 3, // the source message for this crosspost has been deleted (via Channel Following)
|
||||
URGENT = 1 << 4, // this message came from the urgent message system
|
||||
HAS_THREAD = 1 << 5, // this message was used to start a thread (?)
|
||||
HAS_THREAD = 1 << 5, // this message has an associated thread, with the same id as the message
|
||||
EPHEMERAL = 1 << 6, // this message is only visible to the user who invoked the Interaction
|
||||
LOADING = 1 << 7, // this message is an Interaction Response and the bot is "thinking"
|
||||
};
|
||||
|
||||
@@ -147,6 +147,7 @@ void to_json(nlohmann::json &j, const IdentifyProperties &m) {
|
||||
j["os"] = m.OS;
|
||||
j["browser"] = m.Browser;
|
||||
j["device"] = m.Device;
|
||||
j["system_locale"] = m.SystemLocale;
|
||||
j["browser_user_agent"] = m.BrowserUserAgent;
|
||||
j["browser_version"] = m.BrowserVersion;
|
||||
j["os_version"] = m.OSVersion;
|
||||
|
||||
@@ -265,6 +265,7 @@ struct IdentifyProperties {
|
||||
std::string OS;
|
||||
std::string Browser;
|
||||
std::string Device;
|
||||
std::string SystemLocale;
|
||||
std::string BrowserUserAgent;
|
||||
std::string BrowserVersion;
|
||||
std::string OSVersion;
|
||||
|
||||
@@ -7,40 +7,43 @@
|
||||
constexpr static uint64_t PERMISSION_MAX_BIT = 31;
|
||||
enum class Permission : uint64_t {
|
||||
NONE = 0,
|
||||
CREATE_INSTANT_INVITE = (1ULL << 0),
|
||||
KICK_MEMBERS = (1ULL << 1),
|
||||
BAN_MEMBERS = (1ULL << 2),
|
||||
ADMINISTRATOR = (1ULL << 3),
|
||||
MANAGE_CHANNELS = (1ULL << 4),
|
||||
MANAGE_GUILD = (1ULL << 5),
|
||||
ADD_REACTIONS = (1ULL << 6),
|
||||
VIEW_AUDIT_LOG = (1ULL << 7),
|
||||
PRIORITY_SPEAKER = (1ULL << 8),
|
||||
STREAM = (1ULL << 9),
|
||||
VIEW_CHANNEL = (1ULL << 10),
|
||||
SEND_MESSAGES = (1ULL << 11),
|
||||
SEND_TTS_MESSAGES = (1ULL << 12),
|
||||
MANAGE_MESSAGES = (1ULL << 13),
|
||||
EMBED_LINKS = (1ULL << 14),
|
||||
ATTACH_FILES = (1ULL << 15),
|
||||
READ_MESSAGE_HISTORY = (1ULL << 16),
|
||||
MENTION_EVERYONE = (1ULL << 17),
|
||||
USE_EXTERNAL_EMOJIS = (1ULL << 18),
|
||||
VIEW_GUILD_INSIGHTS = (1ULL << 19),
|
||||
CONNECT = (1ULL << 20),
|
||||
SPEAK = (1ULL << 21),
|
||||
MUTE_MEMBERS = (1ULL << 22),
|
||||
DEAFEN_MEMBERS = (1ULL << 23),
|
||||
MOVE_MEMBERS = (1ULL << 24),
|
||||
USE_VAD = (1ULL << 25), // voice activity detection
|
||||
CHANGE_NICKNAME = (1ULL << 26),
|
||||
MANAGE_NICKNAMES = (1ULL << 27),
|
||||
MANAGE_ROLES = (1ULL << 28),
|
||||
MANAGE_WEBHOOKS = (1ULL << 29),
|
||||
MANAGE_EMOJIS = (1ULL << 30),
|
||||
USE_APPLICATION_COMMANDS = (1ULL << 31),
|
||||
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
|
||||
USE_THREADS = (1ULL << 33), // Allows for creating and participating in threads
|
||||
USE_PRIVATE_THREADS = (1ULL << 34), // Allows for creating and participating in private threads
|
||||
|
||||
ALL = 0xFFFFFFFF,
|
||||
ALL = 0x7FFFFFFFFULL,
|
||||
};
|
||||
template<>
|
||||
struct Bitwise<Permission> {
|
||||
@@ -127,14 +130,14 @@ constexpr const char *GetPermissionString(Permission perm) {
|
||||
return "Manage Webhooks";
|
||||
case Permission::MANAGE_EMOJIS:
|
||||
return "Manage Emojis";
|
||||
case Permission::USE_APPLICATION_COMMANDS:
|
||||
case Permission::USE_SLASH_COMMANDS:
|
||||
return "Use Slash Commands";
|
||||
default:
|
||||
return "Unknown Permission";
|
||||
}
|
||||
}
|
||||
|
||||
constexpr const char* GetPermissionDescription(Permission perm) {
|
||||
constexpr const char *GetPermissionDescription(Permission perm) {
|
||||
switch (perm) {
|
||||
case Permission::NONE:
|
||||
return "";
|
||||
@@ -200,7 +203,7 @@ constexpr const char* GetPermissionDescription(Permission perm) {
|
||||
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_APPLICATION_COMMANDS:
|
||||
case Permission::USE_SLASH_COMMANDS:
|
||||
return "Allows members to use slash commands in text channels.";
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -283,7 +283,7 @@ GuildSettingsRolesPaneInfo::GuildSettingsRolesPaneInfo(Snowflake guild_id)
|
||||
Permission::MANAGE_MESSAGES,
|
||||
Permission::READ_MESSAGE_HISTORY,
|
||||
Permission::SEND_TTS_MESSAGES,
|
||||
Permission::USE_APPLICATION_COMMANDS });
|
||||
Permission::USE_SLASH_COMMANDS });
|
||||
|
||||
add_perms("Voice Channels", RIGHT, {
|
||||
Permission::CONNECT,
|
||||
|
||||
Reference in New Issue
Block a user