Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added is_guild_owner for dpp::guild_member #1109

Merged
merged 6 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/dpp/guild.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@ class DPP_EXPORT guild_member : public json_interface<guild_member> {
*/
bool has_rejoined() const;

/**
* @brief Is this user also the guild member?
* @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.
* @note If the guild cache is disabled, this function will always return false.
*/
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(guild_id);
return _guild != nullptr && _guild->owner_id == this->user_id;
AA1999 marked this conversation as resolved.
Show resolved Hide resolved
}

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