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

#include <Message.h>

Inheritance diagram for DiscordCPP::Message:
DiscordCPP::DiscordObject

Public Types

enum  Type {
  DEFAULT , RECIPIENT_ADD , RECIPIENT_REMOVE , CALL ,
  CHANNEL_NAME_CHANGE , CHANNEL_ICON_CHANGE , CHANNEL_PINNED_MESSAGE , GUILD_MEMBER_JOIN
}
 

Public Member Functions

 Message (const json &data, const std::string &token)
 
 Message (const Message &old)
 
 Message ()=default
 
 ~Message ()
 
Message edit (const std::string &content)
 Edit this message.
 
void delete_msg ()
 Delete this message.
 
Message reply (const std::string &content, const bool tts=false)
 Send a reply to this message.
 
Message reply (Embed embed)
 Send an Embed as reply to this message.
 
std::string get_channel_id ()
 
TextChannel get_channel ()
 
std::optional< std::string > get_guild_id ()
 
std::optional< DiscordCPP::Guildget_guild ()
 
User get_author ()
 
std::string get_content ()
 
std::string get_timestamp ()
 
std::string get_edited_timestamp ()
 
bool is_tts ()
 
bool is_mention_everyone ()
 
std::vector< Userget_mentions ()
 
std::vector< Embedget_embeds ()
 
bool is_pinned ()
 
Type get_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

◆ Type

Enumerator
DEFAULT 
RECIPIENT_ADD 
RECIPIENT_REMOVE 
CALL 
CHANNEL_NAME_CHANGE 
CHANNEL_ICON_CHANGE 
CHANNEL_PINNED_MESSAGE 
GUILD_MEMBER_JOIN 

Constructor & Destructor Documentation

◆ Message() [1/3]

DiscordCPP::Message::Message ( const json & data,
const std::string & token )
Parameters
[in]dataraw JSON data
[in]tokendiscord token for the API
Returns
Message object

◆ Message() [2/3]

DiscordCPP::Message::Message ( const Message & old)
Parameters
[in]oldMessage object to copy
Returns
copied Message object

◆ Message() [3/3]

DiscordCPP::Message::Message ( )
default

◆ ~Message()

DiscordCPP::Message::~Message ( )

Member Function Documentation

◆ delete_msg()

void DiscordCPP::Message::delete_msg ( )

Delete this message.

◆ edit()

DiscordCPP::Message DiscordCPP::Message::edit ( const std::string & content)

Edit this message.

Parameters
[in]contentNew message-content.
Returns
Updated message object.

◆ get_author()

User DiscordCPP::Message::get_author ( )
inline
Returns
The author of this message

◆ get_channel()

DiscordCPP::TextChannel DiscordCPP::Message::get_channel ( )
Returns
The Channel the message was sent in

◆ get_channel_id()

std::string DiscordCPP::Message::get_channel_id ( )
inline
Returns
The id of the Channel the message was sent in

◆ get_content()

std::string DiscordCPP::Message::get_content ( )
inline
Returns
The content of this message

◆ get_edited_timestamp()

std::string DiscordCPP::Message::get_edited_timestamp ( )
inline
Returns
When the message was edited

◆ get_embeds()

std::vector< Embed > DiscordCPP::Message::get_embeds ( )
inline
Returns
Array of embeds

◆ get_guild()

std::optional< DiscordCPP::Guild > DiscordCPP::Message::get_guild ( )
Returns
The Guild the message was sent in

◆ get_guild_id()

std::optional< std::string > DiscordCPP::Message::get_guild_id ( )
inline
Returns
The id of the Guild the message was sent in

◆ get_mentions()

std::vector< User > DiscordCPP::Message::get_mentions ( )
inline
Returns
Array of mentioned users

◆ get_timestamp()

std::string DiscordCPP::Message::get_timestamp ( )
inline
Returns
When the message was created

◆ get_type()

Type DiscordCPP::Message::get_type ( )
inline
Returns
The type of the messsage

◆ is_mention_everyone()

bool DiscordCPP::Message::is_mention_everyone ( )
inline
Returns
True, if everyone is mentioned

◆ is_pinned()

bool DiscordCPP::Message::is_pinned ( )
inline
Returns
True, if this message has been pinned

◆ is_tts()

bool DiscordCPP::Message::is_tts ( )
inline
Returns
True, if this is a tts message

◆ reply() [1/2]

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

Send a reply to this message.

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.

◆ reply() [2/2]

DiscordCPP::Message DiscordCPP::Message::reply ( DiscordCPP::Embed embed)

Send an Embed as reply to this message.

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

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