Skip to content

Commit

Permalink
Added a method is_guild_owner for dpp::guild_member to check if said …
Browse files Browse the repository at this point in the history
…member is the guild owner.
  • Loading branch information
AA1999 committed Mar 22, 2024
1 parent 1994480 commit 24e7ef3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/dpp/guild.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ class DPP_EXPORT guild_member : public json_interface<guild_member> {
*/
bool has_rejoined() const;

/**
* @brief Returns true if the user is the guild owner.
* @return true if the user is the guild owner.
* @return false if the user is not the guild owner or the guild is not in the cache.
*/
bool is_guild_owner() const;

/**
* @brief Returns true if the user has completed onboarding
*
Expand Down
5 changes: 5 additions & 0 deletions src/dpp/guild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ bool guild_member::has_rejoined() const {
return flags & dpp::gm_did_rejoin;
}

bool guild_member::is_guild_owner() const {
auto* _guild = find_guild(user_id);
return _guild != nullptr && _guild->owner_id == this->user_id;
}

bool guild_member::has_completed_onboarding() const {
return flags & dpp::gm_completed_onboarding;
}
Expand Down

0 comments on commit 24e7ef3

Please sign in to comment.