D++ (DPP)
C++ Discord API Bot Library
dpp::guild_member Class Reference

Represents dpp::user membership upon a dpp::guild. This contains the user's nickname, guild roles, and any other guild-specific flags. More...

#include <guild.h>

+ Collaboration diagram for dpp::guild_member:

Public Member Functions

 guild_member ()
 
guild_memberfill_from_json (nlohmann::json *j, snowflake g_id, snowflake u_id)
 
std::string build_json (bool with_id=false) const
 Build json string for the member object. 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_muted () const
 Returns true if the user is muted. More...
 
bool is_pending () const
 Returns true if pending verification by membership screening. More...
 
bool has_animated_guild_avatar () const
 Returns true if the user's per-guild custom avatar is animated. More...
 
std::string get_avatar_url (uint16_t size=0) const
 Returns the members per guild avatar if they have one, otherwise returns an empty string. More...
 
guild_memberset_nickname (const std::string &nick)
 Set the nickname. More...
 
dpp::userget_user () const
 Get the dpp::user object for this member. More...
 
guild_memberset_mute (const bool is_muted)
 Set whether the user is muted in voice channels. More...
 
guild_memberset_deaf (const bool is_deafened)
 Set whether the user is deafened in voice channels. More...
 
guild_memberset_communication_disabled_until (const time_t timestamp)
 Set communication_disabled_until. More...
 
std::string get_mention () const
 Return a ping/mention for the user by nickname. More...
 

Public Attributes

std::string nickname
 
std::vector< snowflakeroles
 
snowflake guild_id
 
snowflake user_id
 
utility::iconhash avatar
 
time_t communication_disabled_until
 
time_t joined_at
 
time_t premium_since
 
uint8_t flags
 

Detailed Description

Represents dpp::user membership upon a dpp::guild. This contains the user's nickname, guild roles, and any other guild-specific flags.

Constructor & Destructor Documentation

◆ guild_member()

dpp::guild_member::guild_member ( )

Default constructor

Member Function Documentation

◆ build_json()

std::string dpp::guild_member::build_json ( bool  with_id = false) const

Build json string for the member object.

Parameters
with_idAdd ID to output
Returns
std::string json string

◆ fill_from_json()

guild_member & dpp::guild_member::fill_from_json ( nlohmann::json *  j,
snowflake  g_id,
snowflake  u_id 
)

Fill this object from a json object.

Parameters
jThe json object to get data from
g_idThe guild id to associate the member with
u_idThe user id to associate the member with
Returns
Reference to self for call chaining

◆ get_avatar_url()

std::string dpp::guild_member::get_avatar_url ( uint16_t  size = 0) const

Returns the members per guild avatar if they have one, otherwise returns an empty string.

Note
per-server avatar is a nitro only feature so it might be not set. If you need the real user avatar, use user::get_avatar_url.
Parameters
sizeThe size of the avatar in pixels. It can be any power of two between 16 and 4096. If not specified, the default sized avatar is returned.
Returns
std::string avatar url or empty string

◆ get_mention()

std::string dpp::guild_member::get_mention ( ) const

Return a ping/mention for the user by nickname.

Returns
std::string mention

◆ get_user()

dpp::user * dpp::guild_member::get_user ( ) const

Get the dpp::user object for this member.

Returns
dpp::user user object. If not in cache, it returns nullptr

◆ has_animated_guild_avatar()

bool dpp::guild_member::has_animated_guild_avatar ( ) const

Returns true if the user's per-guild custom avatar is animated.

Returns
true user's custom avatar is animated
false user's custom avatar is not animated

◆ is_communication_disabled()

bool dpp::guild_member::is_communication_disabled ( ) const

Returns true if the user is in time-out (communication disabled)

Returns
true user is in time-out
false user is not in time-out

◆ is_deaf()

bool dpp::guild_member::is_deaf ( ) const

Returns true if the user is deafened.

Returns
true user is deafened
false user is not deafened

◆ is_muted()

bool dpp::guild_member::is_muted ( ) const

Returns true if the user is muted.

Returns
true user muted
false user not muted

◆ is_pending()

bool dpp::guild_member::is_pending ( ) const

Returns true if pending verification by membership screening.

Returns
true user has completed membership screening
false user has not completed membership screening

◆ set_communication_disabled_until()

guild_member & dpp::guild_member::set_communication_disabled_until ( const time_t  timestamp)

Set communication_disabled_until.

Parameters
timestamptimestamp until communication is disabled
Returns
guild_member& reference to self

◆ set_deaf()

guild_member & dpp::guild_member::set_deaf ( const bool  is_deafened)

Set whether the user is deafened in voice channels.

Parameters
is_deafenedvalue to set, true if deaf in voice channels
Returns
guild_member& reference to self

◆ set_mute()

guild_member & dpp::guild_member::set_mute ( const bool  is_muted)

Set whether the user is muted in voice channels.

Parameters
is_mutedvalue to set, true if mute in voice channels
Returns
guild_member& reference to self

◆ set_nickname()

guild_member & dpp::guild_member::set_nickname ( const std::string &  nick)

Set the nickname.

Parameters
nickNickname to set
Returns
guild_member& reference to self

Member Data Documentation

◆ avatar

utility::iconhash dpp::guild_member::avatar

User avatar (per-server avatar is a nitro only feature)

◆ communication_disabled_until

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

◆ flags

uint8_t dpp::guild_member::flags

A set of flags built from the bitmask defined by dpp::guild_member_flags

◆ guild_id

snowflake dpp::guild_member::guild_id

Guild id

◆ joined_at

time_t dpp::guild_member::joined_at

Date and time the user joined the guild

◆ nickname

std::string dpp::guild_member::nickname

Nickname, or empty string if they don't have a nickname on this guild

◆ premium_since

time_t dpp::guild_member::premium_since

Boosting since

◆ roles

std::vector<snowflake> dpp::guild_member::roles

List of roles this user has on this guild

◆ user_id

snowflake dpp::guild_member::user_id

User id

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0