Skip to content

Commit

Permalink
fix: voiceregion now fills correctly, removed VIP from regions. (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 authored Nov 8, 2023
1 parent 4f16307 commit 52261a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
16 changes: 1 addition & 15 deletions include/dpp/voiceregion.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ enum voiceregion_flags {
/**
* @brief A custom voice region (used for events/etc).
*/
v_custom = 0x00000100,

/**
* @brief A VIP voice server.
*
* @warning This is undocumented by Discord and may not even exist anymore.
*/
v_vip = 0x00001000
v_custom = 0x00000100
};

/**
Expand Down Expand Up @@ -123,13 +116,6 @@ class DPP_EXPORT voiceregion : public json_interface<voiceregion> {
* @return true if custom
*/
bool is_custom() const;

/**
* @brief True if is a VIP voice server
*
* @return true if VIP
*/
bool is_vip() const;
};

/**
Expand Down
19 changes: 7 additions & 12 deletions src/dpp/voiceregion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@ voiceregion::voiceregion() : flags(0)
}

voiceregion& voiceregion::fill_from_json_impl(nlohmann::json* j) {
id = string_not_null(j, "id");
name = string_not_null(j, "id");
set_string_not_null(j, "id", id);
set_string_not_null(j, "name", name);

if (bool_not_null(j, "optimal")) {
flags |= v_optimal;
}

if (bool_not_null(j, "deprecated")) {
flags |= v_deprecated;
}

if (bool_not_null(j, "custom")) {
flags |= v_custom;
}
if (bool_not_null(j, "vip")) {
flags |= v_vip;
}

return *this;
}

Expand All @@ -55,8 +56,7 @@ json voiceregion::to_json_impl(bool with_id) const {
{ "name", name },
{ "optimal", is_optimal() },
{ "deprecated", is_deprecated() },
{ "custom", is_custom() },
{ "vip", is_vip() }
{ "custom", is_custom() }
};
}

Expand All @@ -72,10 +72,5 @@ bool voiceregion::is_custom() const {
return flags & v_custom;
}

bool voiceregion::is_vip() const {
return flags & v_vip;
}


} // namespace dpp

0 comments on commit 52261a2

Please sign in to comment.