Skip to content

Commit

Permalink
[Update]: Fix done
Browse files Browse the repository at this point in the history
  • Loading branch information
harshfeudal committed Nov 29, 2022
1 parent 22397a9 commit ae7b14d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
WCHAR_FILES: 'ON'
BUILD_EXAMPLE: 'OFF'
USE_STD_FORMAT: 'ON'
CXX_STANDARD: 20
CXX_STANDARD: 17
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
build_script:
- cmd: >-
Expand Down
46 changes: 12 additions & 34 deletions src/information/userInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
const auto HypesquadBravery = "<:BadgeBravery:1043798197908291645>";
const auto HypesquadBalance = "<:BadgeBalance:1043797533060767835>";
const auto HypesquadBrilliance = "<:BadgeBrilliance:1043798261137408060>";

const auto ActiveDeveloper = "<:BadgeActiveDeveloper:1043797591487426600>";

auto hasStaffBadge = "";
auto hasPartnerBadge = "";
Expand All @@ -62,25 +64,14 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
auto hasNitroBadge = "";

auto hasBoostBadge = "";
auto hasActiveDev = "";

// If the command user is trying to get another people information
if (std::holds_alternative<dpp::snowflake>(event.get_parameter("user")) == true)
usrId = std::get<dpp::snowflake>(event.get_parameter("user"));

// If cannot find the user
if (dpp::find_user(usrId) == false)
{
EmbedBuild(embed, 0xFF7578, errorTitle, warnTitle, "User not found!", event.command.usr);
event.reply(
dpp::message(event.command.channel_id, embed).set_flags(dpp::m_ephemeral)
);

return;
}

dpp::user_identified tgtId = client.user_get_sync(usrId);

// This is under-investigation [Library bug]
if (tgtId.is_discord_employee())
hasStaffBadge = StaffBadge;

Expand All @@ -93,7 +84,6 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
if (tgtId.has_hypesquad_events())
hasEventBadge = EventBadge;

// Only HypeSquad works
if (tgtId.is_house_balance())
hasHouseBadge = HypesquadBalance;
else if (tgtId.is_house_brilliance())
Expand All @@ -111,35 +101,23 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)

if (tgtId.is_early_supporter())
hasEarlySupBadge = EarlySupporter;

if (tgtId.is_active_developer())
hasActiveDev = ActiveDeveloper;

if (tgtId.has_nitro_basic() || tgtId.has_nitro_classic() || tgtId.has_nitro_full())
hasNitroBadge = NitroSubscriber;

std::cout << "member object: " << std::endl;
std::cout << "id " << tgtId.id << std::endl;
std::cout << "username " << tgtId.username << std::endl;
std::cout << "flags " << tgtId.flags << std::endl;
std::cout << "bravery " << tgtId.is_house_bravery() << std::endl;
std::cout << "brilliance " << tgtId.is_house_brilliance() << std::endl;
std::cout << "balance " << tgtId.is_house_balance() << std::endl;
std::cout << "is_bot " << tgtId.is_bot() << std::endl;
std::cout << "is_active_developer " << tgtId.is_active_developer() << std::endl;
std::cout << "has_nitro_basic " << tgtId.has_nitro_basic() << std::endl;
std::cout << "has_nitro_classic " << tgtId.has_nitro_classic() << std::endl;
std::cout << "has_nitro_full " << tgtId.has_nitro_full() << std::endl;
std::cout << "is_verified_bot_dev " << tgtId.is_verified_bot_dev() << std::endl;
std::cout << "is_bughunter_1 " << tgtId.is_bughunter_1() << std::endl;
std::cout << "is_bughunter_2 " << tgtId.is_bughunter_2() << std::endl;
// Cannot get nitro badge, probably, I read doc again
// Working with another way

const auto avatar = tgtId.get_avatar_url();
const auto usrID = fmt::format("{}", tgtId.id);
const auto created = fmt::format("<t:{}:R>", round(tgtId.get_creation_time()));
const auto usrName = fmt::format("{}", tgtId.format_username());

// The badge cannot show now because the pointer is error ... will fix it ASAP
auto BadgeShow = fmt::format("{}{}{}{}{}{}{}{}{}{}",
hasStaffBadge, hasPartnerBadge, hasModBadge, hasEventBadge, hasHouseBadge,
hasBugHunterBadge, hasBotDevBadge, hasEarlySupBadge, hasNitroBadge, hasBoostBadge
auto BadgeShow = fmt::format("{}{}{}{}{}{}{}{}{}{}{}",
hasStaffBadge, hasPartnerBadge, hasModBadge, hasEventBadge, hasHouseBadge,
hasBugHunterBadge, hasActiveDev, hasBotDevBadge, hasEarlySupBadge, hasNitroBadge,
hasBoostBadge
);

// Check if the user doesn't have any badge
Expand Down

0 comments on commit ae7b14d

Please sign in to comment.