D++ (DPP)
C++ Discord API Bot Library
|
Represents dpp::user membership upon a dpp::guild. This contains the user's nickname, guild roles, and any other guild-specific flags. More...
Public Member Functions | |
guild_member () | |
guild_member & | fill_from_json (nlohmann::json *j, snowflake g_id, snowflake u_id) |
Fill this object from a json 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_rejoined () const |
Returns true if the user has left and rejoined the guild. More... | |
bool | is_guild_owner () const |
Is this user also the guild member? More... | |
bool | has_completed_onboarding () const |
Returns true if the user has completed onboarding. More... | |
bool | has_started_onboarding () const |
Returns true if the user has started onboarding. More... | |
bool | has_bypasses_verification () const |
Returns true if the user is exempt from guild verification requirements. 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 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... | |
guild_member & | set_nickname (const std::string &nick) |
Set the 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. This is an alias for dpp::find_user. More... | |
bool | operator== (guild_member const &other_member) const |
Check if this member is equal to another member object. 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_mute (const bool is_muted) |
Set whether the user is muted in voice channels. More... | |
guild_member & | set_deaf (const bool is_deafened) |
Set whether the user is deafened in voice channels. More... | |
guild_member & | set_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... | |
guild_member & | add_role (dpp::snowflake role_id) |
Add a role to this member. More... | |
guild_member & | remove_role (dpp::snowflake role_id) |
Remove a role from this member. More... | |
guild_member & | set_roles (const std::vector< dpp::snowflake > &role_ids) |
Set a new role list for this member. More... | |
guild_member & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
Public Attributes | |
snowflake | guild_id |
Guild id. More... | |
snowflake | user_id |
User id. More... | |
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... | |
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... | |
Protected Member Functions | |
json | to_json_impl (bool with_id=false) const |
Build json for the member object. More... | |
Protected Attributes | |
std::string | nickname |
Nickname. More... | |
std::vector< snowflake > | roles |
List of roles this user has on this guild. More... | |
uint16_t | flags |
A set of flags built from the bitmask defined by dpp::guild_member_flags. More... | |
Friends | |
struct | json_interface< guild_member > |
void | from_json (const nlohmann::json &j, guild_member &gm) |
helper function to deserialize a guild_member from json More... | |
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
guild_member& dpp::guild_member::add_role | ( | dpp::snowflake | role_id | ) |
Add a role to this member.
role_id | Role ID to add |
|
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 |
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.
const std::vector<dpp::snowflake>& dpp::guild_member::get_roles | ( | ) | const |
Get the roles.
user* dpp::guild_member::get_user | ( | ) | const |
Find the dpp::user object for this member. This is an alias for dpp::find_user.
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.
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.
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.
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 |
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 |
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.
|
protected |
A set of flags built from the bitmask defined by dpp::guild_member_flags.
snowflake dpp::guild_member::guild_id |
Guild id.
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.
snowflake dpp::guild_member::user_id |
User id.