mirror of
https://github.com/uowuo/abaddon.git
synced 2024-11-10 06:00:10 +00:00
Merge branch 'master' of https://github.com/uowuo/abaddon
This commit is contained in:
commit
01865075a4
@ -347,7 +347,7 @@ For example, memory_db would be set by adding `memory_db = true` under the line
|
|||||||
|
|
||||||
| Setting | Type | Default | Description |
|
| Setting | Type | Default | Description |
|
||||||
|---------------|---------|---------|-------------------------|
|
|---------------|---------|---------|-------------------------|
|
||||||
| `hideconsole` | boolean | true | Hide console on startup |
|
| `hideconsole` | boolean | false | Hide console on startup |
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
|
@ -220,34 +220,34 @@ void UserData::update_from_json(const nlohmann::json &j) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *UserData::GetFlagName(uint64_t flag) {
|
const char *UserData::GetFlagName(uint64_t flag) {
|
||||||
switch (flag) {
|
switch (static_cast<UserData::EFlags>(flag)) {
|
||||||
case DiscordEmployee:
|
case UserData::EFlags::DiscordEmployee:
|
||||||
return "discordstaff";
|
return "discordstaff";
|
||||||
case PartneredServerOwner:
|
case UserData::EFlags::PartneredServerOwner:
|
||||||
return "partneredowner";
|
return "partneredowner";
|
||||||
case HypeSquadEvents:
|
case UserData::EFlags::HypeSquadEvents:
|
||||||
return "hypesquadevents";
|
return "hypesquadevents";
|
||||||
case BugHunterLevel1:
|
case UserData::EFlags::BugHunterLevel1:
|
||||||
return "discordbughunter";
|
return "discordbughunter";
|
||||||
case HouseBravery:
|
case UserData::EFlags::HouseBravery:
|
||||||
return "hypesquadbravery";
|
return "hypesquadbravery";
|
||||||
case HouseBrilliance:
|
case UserData::EFlags::HouseBrilliance:
|
||||||
return "hypesquadbrilliance";
|
return "hypesquadbrilliance";
|
||||||
case HouseBalance:
|
case UserData::EFlags::HouseBalance:
|
||||||
return "hypesquadbalance";
|
return "hypesquadbalance";
|
||||||
case EarlySupporter:
|
case UserData::EFlags::EarlySupporter:
|
||||||
return "earlysupporter";
|
return "earlysupporter";
|
||||||
case TeamUser:
|
case UserData::EFlags::TeamUser:
|
||||||
return "teamuser";
|
return "teamuser";
|
||||||
case System:
|
case UserData::EFlags::System:
|
||||||
return "system";
|
return "system";
|
||||||
case BugHunterLevel2:
|
case UserData::EFlags::BugHunterLevel2:
|
||||||
return "discordbughunter2";
|
return "discordbughunter2";
|
||||||
case VerifiedBot:
|
case UserData::EFlags::VerifiedBot:
|
||||||
return "verifiedbot";
|
return "verifiedbot";
|
||||||
case EarlyVerifiedBotDeveloper:
|
case UserData::EFlags::EarlyVerifiedBotDeveloper:
|
||||||
return "earlyverifiedbotdeveloper";
|
return "earlyverifiedbotdeveloper";
|
||||||
case CertifiedModerator:
|
case UserData::EFlags::CertifiedModerator:
|
||||||
return "certifiedmoderator";
|
return "certifiedmoderator";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
@ -255,34 +255,34 @@ const char *UserData::GetFlagName(uint64_t flag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *UserData::GetFlagReadableName(uint64_t flag) {
|
const char *UserData::GetFlagReadableName(uint64_t flag) {
|
||||||
switch (flag) {
|
switch (static_cast<UserData::EFlags>(flag)) {
|
||||||
case DiscordEmployee:
|
case UserData::EFlags::DiscordEmployee:
|
||||||
return "Discord Staff";
|
return "Discord Staff";
|
||||||
case PartneredServerOwner:
|
case UserData::EFlags::PartneredServerOwner:
|
||||||
return "Partnered Server Owner";
|
return "Partnered Server Owner";
|
||||||
case HypeSquadEvents:
|
case UserData::EFlags::HypeSquadEvents:
|
||||||
return "HypeSquad Events";
|
return "HypeSquad Events";
|
||||||
case BugHunterLevel1:
|
case UserData::EFlags::BugHunterLevel1:
|
||||||
return "Discord Bug Hunter";
|
return "Discord Bug Hunter";
|
||||||
case HouseBravery:
|
case UserData::EFlags::HouseBravery:
|
||||||
return "HypeSquad Bravery";
|
return "HypeSquad Bravery";
|
||||||
case HouseBrilliance:
|
case UserData::EFlags::HouseBrilliance:
|
||||||
return "HypeSquad Brilliance";
|
return "HypeSquad Brilliance";
|
||||||
case HouseBalance:
|
case UserData::EFlags::HouseBalance:
|
||||||
return "HypeSquad Balance";
|
return "HypeSquad Balance";
|
||||||
case EarlySupporter:
|
case UserData::EFlags::EarlySupporter:
|
||||||
return "Early Supporter";
|
return "Early Supporter";
|
||||||
case TeamUser:
|
case UserData::EFlags::TeamUser:
|
||||||
return "Team User"; // ???
|
return "Team User"; // ???
|
||||||
case System:
|
case UserData::EFlags::System:
|
||||||
return "System";
|
return "System";
|
||||||
case BugHunterLevel2:
|
case UserData::EFlags::BugHunterLevel2:
|
||||||
return "Discord Bug Hunter Level 2";
|
return "Discord Bug Hunter Level 2";
|
||||||
case VerifiedBot:
|
case UserData::EFlags::VerifiedBot:
|
||||||
return "Verified Bot";
|
return "Verified Bot";
|
||||||
case EarlyVerifiedBotDeveloper:
|
case UserData::EFlags::EarlyVerifiedBotDeveloper:
|
||||||
return "Early Verified Bot Developer";
|
return "Early Verified Bot Developer";
|
||||||
case CertifiedModerator:
|
case UserData::EFlags::CertifiedModerator:
|
||||||
return "Discord Certified Moderator";
|
return "Discord Certified Moderator";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
@ -11,8 +11,7 @@ enum class EPremiumType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct UserData {
|
struct UserData {
|
||||||
// todo: enum class? (for consistencys sake)
|
enum class EFlags : uint64_t {
|
||||||
enum {
|
|
||||||
DiscordEmployee = 1 << 0,
|
DiscordEmployee = 1 << 0,
|
||||||
PartneredServerOwner = 1 << 1,
|
PartneredServerOwner = 1 << 1,
|
||||||
HypeSquadEvents = 1 << 2,
|
HypeSquadEvents = 1 << 2,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "profilewindow.hpp"
|
#include "profilewindow.hpp"
|
||||||
|
|
||||||
#include "abaddon.hpp"
|
#include "abaddon.hpp"
|
||||||
|
#include "discord/user.hpp"
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
|
|
||||||
ProfileWindow::ProfileWindow(Snowflake user_id)
|
ProfileWindow::ProfileWindow(Snowflake user_id)
|
||||||
@ -116,13 +117,13 @@ void ProfileWindow::OnFetchProfile(const UserProfileData &data) {
|
|||||||
|
|
||||||
if (!data.User.PublicFlags.has_value()) return;
|
if (!data.User.PublicFlags.has_value()) return;
|
||||||
const auto x = *data.User.PublicFlags;
|
const auto x = *data.User.PublicFlags;
|
||||||
for (uint64_t i = 1; i <= UserData::MaxFlag; i <<= 1) {
|
for (uint64_t i = 1; i <= static_cast<uint64_t>(UserData::EFlags::MaxFlag); i <<= 1) {
|
||||||
if (!(x & i)) continue;
|
if (!(x & i)) continue;
|
||||||
const std::string name = UserData::GetFlagName(i);
|
const std::string name = UserData::GetFlagName(i);
|
||||||
if (name == "unknown") continue;
|
if (name == "unknown") continue;
|
||||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
|
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
|
||||||
try {
|
try {
|
||||||
if (name == "verifiedbot")
|
if (i == static_cast<uint64_t>(UserData::EFlags::VerifiedBot))
|
||||||
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/checkmark.png"), 24, 24);
|
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/checkmark.png"), 24, 24);
|
||||||
else
|
else
|
||||||
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + name + ".png"), 24, 24);
|
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + name + ".png"), 24, 24);
|
||||||
|
Loading…
Reference in New Issue
Block a user