diff --git a/include/dpp/guild.h b/include/dpp/guild.h index cbb394ce15..013c3e5971 100644 --- a/include/dpp/guild.h +++ b/include/dpp/guild.h @@ -520,6 +520,13 @@ class DPP_EXPORT guild_member : public json_interface { */ 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 * diff --git a/src/dpp/guild.cpp b/src/dpp/guild.cpp index a1162321ea..eaff146be1 100644 --- a/src/dpp/guild.cpp +++ b/src/dpp/guild.cpp @@ -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; }