Represents dpp::user membership upon a dpp::guild. More...
#include "guild.h"
Public Member Functions | |
guild_member () | |
Default constructor. More... | |
guild_member & | add_role (dpp::snowflake role_id) |
Add a role to this member. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
guild_member & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
guild_member & | fill_from_json (nlohmann::json *j, snowflake g_id, snowflake u_id) |
Fill this object from a json object. More... | |
std::string | get_avatar_url (uint16_t size=0, const image_type format=i_png, bool prefer_animated=true) const |
Returns the member's per guild avatar url if they have one, otherwise returns an empty string. More... | |
std::string | get_mention () const |
Return a ping/mention for the user by nickname. More... | |
std::string | get_nickname () const |
Get the nickname. More... | |
const std::vector< dpp::snowflake > & | get_roles () const |
Get the roles. More... | |
user * | get_user () const |
Find the dpp::user object for this member. More... | |
bool | has_animated_guild_avatar () const |
Returns true if the user's per-guild custom avatar is animated. More... | |
bool | has_bypasses_verification () const |
Returns true if the user is exempt from guild verification requirements. More... | |
bool | has_completed_onboarding () const |
Returns true if the user has completed onboarding. More... | |
bool | has_rejoined () const |
Returns true if the user has left and rejoined the guild. More... | |
bool | has_started_onboarding () const |
Returns true if the user has started onboarding. More... | |
bool | is_communication_disabled () const |
Returns true if the user is in time-out (communication disabled) More... | |
bool | is_deaf () const |
Returns true if the user is deafened. More... | |
bool | is_guild_owner () const |
Is this user also the guild member? More... | |
bool | is_muted () const |
Returns true if the user is muted. More... | |
bool | is_pending () const |
Returns true if pending verification by membership screening. More... | |
bool | operator== (guild_member const &other_member) const |
Check if this member is equal to another member object. More... | |
guild_member & | remove_role (dpp::snowflake role_id) |
Remove a role from this member. More... | |
guild_member & | set_bypasses_verification (const bool is_bypassing_verification) |
Set whether the user is exempt from guild verification requirements. More... | |
guild_member & | set_communication_disabled_until (const time_t timestamp) |
Set communication_disabled_until. More... | |
guild_member & | set_deaf (const bool is_deafened) |
Set whether the user is deafened in voice channels. More... | |
guild_member & | set_mute (const bool is_muted) |
Set whether the user is muted in voice channels. More... | |
guild_member & | set_nickname (const std::string &nick) |
Set the nickname. More... | |
guild_member & | set_roles (const std::vector< dpp::snowflake > &role_ids) |
Set a new role list for this member. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
Public Attributes | |
utility::iconhash | avatar |
User avatar. More... | |
time_t | communication_disabled_until |
Timestamp of when the time out will be removed; until then, they cannot interact with the guild. More... | |
snowflake | guild_id |
Guild id. More... | |
time_t | joined_at |
Date and time the user joined the guild. More... | |
time_t | premium_since |
The Date and time the user started boosting. More... | |
snowflake | user_id |
User id. More... | |
Protected Member Functions | |
json | to_json_impl (bool with_id=false) const |
Build json for the member object. More... | |
Protected Attributes | |
uint16_t | flags |
A set of flags built from the bitmask defined by dpp::guild_member_flags. More... | |
std::string | nickname |
Nickname. More... | |
std::vector< snowflake > | roles |
List of roles this user has on this guild. More... | |
Friends | |
void | from_json (const nlohmann::json &j, guild_member &gm) |
helper function to deserialize a guild_member from json More... | |
struct | json_interface< guild_member > |
Represents dpp::user membership upon a dpp::guild.
This contains the user's nickname, guild roles, and any other guild-specific flags.
dpp::guild_member::guild_member | ( | ) |
Default constructor.
References flags, dpp::gm_roles_action, and roles.
guild_member & dpp::guild_member::add_role | ( | dpp::snowflake | role_id | ) |
Add a role to this member.
role_id | Role ID to add |
References flags, dpp::gm_roles_action, and roles.
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
guild_member & dpp::guild_member::fill_from_json | ( | nlohmann::json * | j, |
snowflake | g_id, | ||
snowflake | u_id | ||
) |
Fill this object from a json object.
j | The json object to get data from |
g_id | The guild id to associate the member with |
u_id | The user id to associate the member with |
Referenced by dpp::cluster::guild_get_member().
std::string dpp::guild_member::get_avatar_url | ( | uint16_t | size = 0 , |
const image_type | format = i_png , |
||
bool | prefer_animated = true |
||
) | const |
Returns the member's per guild avatar url if they have one, otherwise returns an empty string.
size | The size of the avatar in pixels. It can be any power of two between 16 and 4096, otherwise the default sized avatar is returned. |
format | The format to use for the avatar. It can be one of i_webp , i_jpg , i_png or i_gif . When passing i_gif , it returns an empty string for non-animated images. Consider using the prefer_animated parameter instead. |
prefer_animated | Whether you prefer gif format. If true, it'll return gif format whenever the image is available as animated. |
std::string dpp::guild_member::get_mention | ( | ) | const |
Return a ping/mention for the user by nickname.
std::string dpp::guild_member::get_nickname | ( | ) | const |
Get the nickname.
References flags, dpp::gm_mute, dpp::gm_voice_action, and is_muted().
const std::vector< dpp::snowflake > & dpp::guild_member::get_roles | ( | ) | const |
Get the roles.
Referenced by dpp::guild_widget::to_json_impl().
user * dpp::guild_member::get_user | ( | ) | const |
Find the dpp::user object for this member.
This is an alias for dpp::find_user
References dpp::find_guild(), guild_id, and user_id.
bool dpp::guild_member::has_animated_guild_avatar | ( | ) | const |
Returns true if the user's per-guild custom avatar is animated.
bool dpp::guild_member::has_bypasses_verification | ( | ) | const |
Returns true if the user is exempt from guild verification requirements.
References dpp::welcome_channel::emoji_id.
bool dpp::guild_member::has_completed_onboarding | ( | ) | const |
Returns true if the user has completed onboarding.
bool dpp::guild_member::has_rejoined | ( | ) | const |
Returns true if the user has left and rejoined the guild.
bool dpp::guild_member::has_started_onboarding | ( | ) | const |
Returns true if the user has started onboarding.
References dpp::welcome_channel::channel_id.
bool dpp::guild_member::is_communication_disabled | ( | ) | const |
Returns true if the user is in time-out (communication disabled)
bool dpp::guild_member::is_deaf | ( | ) | const |
Returns true if the user is deafened.
bool dpp::guild_member::is_guild_owner | ( | ) | const |
Is this user also the guild member?
bool dpp::guild_member::is_muted | ( | ) | const |
Returns true if the user is muted.
Referenced by get_nickname().
bool dpp::guild_member::is_pending | ( | ) | const |
Returns true if pending verification by membership screening.
bool dpp::guild_member::operator== | ( | guild_member const & | other_member | ) | const |
Check if this member is equal to another member object.
other_member | other member object to compare |
guild_member & dpp::guild_member::remove_role | ( | dpp::snowflake | role_id | ) |
Remove a role from this member.
role_id | Role ID to remove |
guild_member & dpp::guild_member::set_bypasses_verification | ( | const bool | is_bypassing_verification | ) |
Set whether the user is exempt from guild verification requirements.
is_bypassing_verification | value to set |
guild_member & dpp::guild_member::set_communication_disabled_until | ( | const time_t | timestamp | ) |
Set communication_disabled_until.
timestamp | timestamp until communication is disabled |
References communication_disabled_until.
guild_member & dpp::guild_member::set_deaf | ( | const bool | is_deafened | ) |
Set whether the user is deafened in voice channels.
is_deafened | value to set, true if deaf in voice channels |
guild_member & dpp::guild_member::set_mute | ( | const bool | is_muted | ) |
Set whether the user is muted in voice channels.
is_muted | value to set, true if mute in voice channels |
guild_member & dpp::guild_member::set_nickname | ( | const std::string & | nick | ) |
guild_member & dpp::guild_member::set_roles | ( | const std::vector< dpp::snowflake > & | role_ids | ) |
Set a new role list for this member.
role_ids | Roles to set |
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
protected |
Build json for the member object.
with_id | Add ID to output |
|
friend |
helper function to deserialize a guild_member from json
j | output json object |
gm | guild_member to be deserialized |
|
friend |
utility::iconhash dpp::guild_member::avatar |
User avatar.
time_t dpp::guild_member::communication_disabled_until |
Timestamp of when the time out will be removed; until then, they cannot interact with the guild.
Referenced by set_communication_disabled_until().
|
protected |
A set of flags built from the bitmask defined by dpp::guild_member_flags.
Referenced by add_role(), get_nickname(), guild_member(), and dpp::guild::remove_icon().
snowflake dpp::guild_member::guild_id |
Guild id.
Referenced by get_user().
time_t dpp::guild_member::joined_at |
Date and time the user joined the guild.
|
protected |
Nickname.
time_t dpp::guild_member::premium_since |
The Date and time the user started boosting.
|
protected |
List of roles this user has on this guild.
Referenced by add_role(), and guild_member().
snowflake dpp::guild_member::user_id |
User id.
Referenced by get_user(), dpp::guild::set_splash(), and dpp::guild_widget::to_json_impl().