D++ (DPP)
C++ Discord API Bot Library
dpp::message Struct Reference

Represents messages sent and received on Discord. More...

#include <message.h>

+ Collaboration diagram for dpp::message:

Public Member Functions

 message ()
 Construct a new message object. More...
 
 message (snowflake channel_id, const std::string &content, message_type type=mt_default)
 Construct a new message object with a channel and content. More...
 
 message (snowflake channel_id, const embed &_embed)
 Construct a new message object with a channel and content. More...
 
 message (const std::string &content, message_type type=mt_default)
 Construct a new message object with content. More...
 
messagefill_from_json (nlohmann::json *j)
 
std::string build_json (bool with_id=false) const
 
bool is_crossposted () const
 
bool is_crosspost () const
 
bool supress_embeds () const
 
bool is_source_message_deleted () const
 
bool is_urgent () const
 
bool is_ephemeral () const
 
bool is_loading () const
 

Public Attributes

snowflake id
 
snowflake channel_id
 
snowflake guild_id
 
userauthor
 
guild_membermember
 
std::string content
 
time_t sent
 
time_t edited
 
bool tts
 
bool mention_everyone
 
std::vector< snowflakementions
 
std::vector< snowflakemention_roles
 
std::vector< snowflakemention_channels
 
std::vector< const unsigned char * > attachments
 
std::vector< embedembeds
 
std::vector< reactionreactions
 
std::string nonce
 
bool pinned
 
snowflake webhook_id
 
uint8_t flags
 
std::string filename
 
std::string filecontent
 
uint8_t type
 

Detailed Description

Represents messages sent and received on Discord.

Constructor & Destructor Documentation

◆ message() [1/4]

dpp::message::message ( )

Construct a new message object.

◆ message() [2/4]

dpp::message::message ( snowflake  channel_id,
const std::string &  content,
message_type  type = mt_default 
)

Construct a new message object with a channel and content.

Parameters
channel_idThe channel to send the message to
contentThe content of the message
typeThe message type to create

◆ message() [3/4]

dpp::message::message ( snowflake  channel_id,
const embed _embed 
)

Construct a new message object with a channel and content.

Parameters
channel_idThe channel to send the message to
_embedAn embed to send

◆ message() [4/4]

dpp::message::message ( const std::string &  content,
message_type  type = mt_default 
)

Construct a new message object with content.

Parameters
contentThe content of the message
typeThe message type to create

Member Function Documentation

◆ build_json()

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

Build JSON from this object.

Parameters
with_idTrue if the ID is to be included in the built JSON
Returns
The JSON text of the message

◆ fill_from_json()

message & dpp::message::fill_from_json ( nlohmann::json j)

Fill this object from json.

Parameters
jJSON object to fill from
Returns
A reference to self

◆ is_crosspost()

bool dpp::message::is_crosspost ( ) const

◆ is_crossposted()

bool dpp::message::is_crossposted ( ) const

◆ is_ephemeral()

bool dpp::message::is_ephemeral ( ) const

◆ is_loading()

bool dpp::message::is_loading ( ) const

◆ is_source_message_deleted()

bool dpp::message::is_source_message_deleted ( ) const

◆ is_urgent()

bool dpp::message::is_urgent ( ) const

◆ supress_embeds()

bool dpp::message::supress_embeds ( ) const

Member Data Documentation

◆ attachments

std::vector<const unsigned char*> dpp::message::attachments

any attached files

◆ author

user* dpp::message::author

the author of this message (not guaranteed to be a valid user)

◆ channel_id

snowflake dpp::message::channel_id

id of the channel the message was sent in

◆ content

std::string dpp::message::content

contents of the message

◆ edited

time_t dpp::message::edited

when this message was edited (may be 0 if never edited)

◆ embeds

std::vector<embed> dpp::message::embeds

zero or more dpp::embed objects

◆ filecontent

std::string dpp::message::filecontent

File content to upload (raw binary)

◆ filename

std::string dpp::message::filename

Name of file to upload (for use server-side in discord's url)

◆ flags

uint8_t dpp::message::flags

Flags

◆ guild_id

snowflake dpp::message::guild_id

Optional: id of the guild the message was sent in

◆ id

snowflake dpp::message::id

id of the message

◆ member

guild_member* dpp::message::member

Optional: member properties for this message's author

◆ mention_channels

std::vector<snowflake> dpp::message::mention_channels

Optional: channels specifically mentioned in this message

◆ mention_everyone

bool dpp::message::mention_everyone

whether this message mentions everyone

◆ mention_roles

std::vector<snowflake> dpp::message::mention_roles

roles specifically mentioned in this message

◆ mentions

std::vector<snowflake> dpp::message::mentions

users specifically mentioned in the message

◆ nonce

std::string dpp::message::nonce

Optional: used for validating a message was sent

◆ pinned

bool dpp::message::pinned

whether this message is pinned

◆ reactions

std::vector<reaction> dpp::message::reactions

Optional: reactions to the message

◆ sent

time_t dpp::message::sent

when this message was sent

◆ tts

bool dpp::message::tts

whether this was a TTS message

◆ type

uint8_t dpp::message::type

Message type

◆ webhook_id

snowflake dpp::message::webhook_id

Optional: if the message is generated by a webhook, its id will be here otherwise the field will be 0

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