Discord.C++ 0.13.0
Loading...
Searching...
No Matches
DiscordCPP::User Class Reference

#include <User.h>

Inheritance diagram for DiscordCPP::User:
DiscordCPP::DiscordObject DiscordCPP::Member

Public Types

enum  PremiumType { None , NitroClassic , Nitro }
 

Public Member Functions

 User ()=default
 
 User (const json &data, const std::string &token)
 
 User (const std::string &id, const std::string &token)
 
virtual ~User ()=default
 
DMChannel get_dmchannel ()
 get/create the DMChannel for this user
 
Message send (const std::string &content, const bool tts=false)
 send a message to this user
 
Message send (const Embed &embed)
 send an embed to this user
 
virtual operator std::string ()
 
std::string get_username ()
 the user's name
 
std::string get_discriminator ()
 the user's discord-tag
 
std::string get_avatar ()
 the user's avatar hash
 
bool is_bot ()
 true, if the user is a bot
 
bool is_mfa_enabled ()
 true, if the user has enabled two factor authentification
 
std::string get_locale ()
 the user's chosen language option
 
bool is_verified ()
 true, if the user's email has been verified
 
std::string get_email ()
 the user's email
 
int get_flags ()
 the flags on a user's account
 
PremiumType get_premium_type ()
 
- Public Member Functions inherited from DiscordCPP::DiscordObject
 DiscordObject ()=default
 
 DiscordObject (std::string token)
 
 DiscordObject (std::string token, std::string id)
 
std::string get_id () const
 

Additional Inherited Members

- Protected Member Functions inherited from DiscordCPP::DiscordObject
std::string get_token () const
 
json api_call (const std::string &url, const std::string &method="GET", const json &data=json(), const std::string &content_type="", const bool cache=true)
 helper function to communicate with the http api
 

Member Enumeration Documentation

◆ PremiumType

Enumerator
None 
NitroClassic 
Nitro 

Constructor & Destructor Documentation

◆ User() [1/3]

DiscordCPP::User::User ( )
default

◆ User() [2/3]

DiscordCPP::User::User ( const json & data,
const std::string & token )

◆ User() [3/3]

DiscordCPP::User::User ( const std::string & id,
const std::string & token )

◆ ~User()

virtual DiscordCPP::User::~User ( )
virtualdefault

Member Function Documentation

◆ get_avatar()

std::string DiscordCPP::User::get_avatar ( )
inline

the user's avatar hash

◆ get_discriminator()

std::string DiscordCPP::User::get_discriminator ( )
inline

the user's discord-tag

◆ get_dmchannel()

DiscordCPP::DMChannel DiscordCPP::User::get_dmchannel ( )

get/create the DMChannel for this user

Returns
DMChannel

◆ get_email()

std::string DiscordCPP::User::get_email ( )
inline

the user's email

◆ get_flags()

int DiscordCPP::User::get_flags ( )
inline

the flags on a user's account

◆ get_locale()

std::string DiscordCPP::User::get_locale ( )
inline

the user's chosen language option

◆ get_premium_type()

PremiumType DiscordCPP::User::get_premium_type ( )
inline
Returns
the type of Nitro subscription on a user's account

◆ get_username()

std::string DiscordCPP::User::get_username ( )
inline

the user's name

◆ is_bot()

bool DiscordCPP::User::is_bot ( )
inline

true, if the user is a bot

◆ is_mfa_enabled()

bool DiscordCPP::User::is_mfa_enabled ( )
inline

true, if the user has enabled two factor authentification

◆ is_verified()

bool DiscordCPP::User::is_verified ( )
inline

true, if the user's email has been verified

◆ operator std::string()

virtual DiscordCPP::User::operator std::string ( )
inlineexplicitvirtual
Returns
Username as std::string

Reimplemented in DiscordCPP::Member.

◆ send() [1/2]

DiscordCPP::Message DiscordCPP::User::send ( const Embed & embed)

send an embed to this user

Parameters
[in]embedThe Embed to send.
Returns
The message that was sent.

◆ send() [2/2]

DiscordCPP::Message DiscordCPP::User::send ( const std::string & content,
const bool tts = false )

send a message to this user

Parameters
[in]contentThe string message to send.
[in]tts(optional) Wether to send as tts-message or not. Default is false.
Returns
The message that was sent.

The documentation for this class was generated from the following files: