aegis.cpp
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
aegis::gateway::objects::message Class Reference

#include <message.hpp>

Public Member Functions

 message (const std::string &content, aegis::channel *_channel, aegis::guild *_guild) noexcept
 Constructor for the message object. More...
 
 message (const std::string &_json, aegis::core *_core) noexcept
 Constructor for the message object. More...
 
 message (const nlohmann::json &_json, aegis::core *_core) noexcept
 Constructor for the message object. More...
 
 message (aegis::core *_core) noexcept
 Constructor for the message object. More...
 
void set_channel (aegis::channel *_channel)
 
void set_guild (aegis::guild *_guild)
 
messageoperator= (const message &)=default
 
 message (const message &)=default
 
 message (message &&msg)=default
 
bool operator== (const std::string &rhs)
 Comparison of message content.
 
bool operator!= (const std::string &rhs)
 Comparison of message content.
 
bool operator== (const char *rhs)
 Comparison of message content.
 
bool operator!= (const char *rhs)
 Comparison of message content.
 
bool is_dm () const noexcept
 Whether message is a Direct Message. More...
 
bool is_bot () const noexcept
 Whether message is from a bot. More...
 
bool is_webhook () const noexcept
 Whether message is from a webhook. More...
 
const std::string & get_content () const noexcept
 Get a reference to the content of the message. More...
 
void set_content (const std::string &content) noexcept
 Set the message's content. More...
 
snowflake get_id () const noexcept
 Get the ID of the message. More...
 
snowflake get_channel_id () const noexcept
 Get the Channel ID of the message. More...
 
snowflake get_guild_id () const noexcept
 Get the Guild ID of the message. More...
 
snowflake get_author_id () const noexcept
 Get the Member ID of the author of the message. More...
 
bool has_guild () const noexcept
 
bool has_channel () const noexcept
 Whether the message has a valid channel set. More...
 
bool has_member () const noexcept
 Whether the message has a valid member set. More...
 
aegis::guildget_guild ()
 Get a reference to the guild object this message was sent in. More...
 
aegis::channelget_channel ()
 Get a reference to the channel object this message was sent in. More...
 
aegis::userget_user ()
 Get a reference to the user object this message was sent by. More...
 
aegis::future< rest::rest_replydelete_message ()
 Delete this message. More...
 
aegis::future< messageedit (const std::string &content)
 Edit this message. More...
 
aegis::future< messageedit (edit_message_t &obj)
 Edit this message. More...
 
aegis::future< rest::rest_replycreate_reaction (const std::string &content)
 Add a reaction to this message. More...
 
aegis::future< rest::rest_replydelete_own_reaction (const std::string &content)
 Delete your reaction to this message. More...
 
aegis::future< rest::rest_replydelete_user_reaction (const std::string &content, const snowflake member_id)
 Delete other user reaction to this message (not available for DMs) More...
 
aegis::future< rest::rest_replydelete_all_reactions ()
 Delete all reactions on this message (not available for DMs) More...
 
std::tuple< snowflake,
snowflake, snowflake,
snowflake
get_related_ids () const noexcept
 Obtain the relevant snowflakes related to this message. More...
 

Public Attributes

std::string timestamp
 
std::string edited_timestamp
 
bool tts = false
 
bool mention_everyone = false
 
std::vector< snowflakementions
 
std::vector< snowflakemention_roles
 
std::vector< objects::attachmentattachments
 
std::vector< objects::embedembeds
 
bool pinned = false
 
std::vector< objects::reactionreactions
 
snowflake nonce
 
std::string webhook_id
 
objects::message_type type = Default
 
user author
 

Friends

class aegis::core
 
void from_json (const nlohmann::json &j, objects::message &m)
 
void to_json (nlohmann::json &j, const objects::message &m)
 

Detailed Description

Todo:
Needs documentation

Constructor & Destructor Documentation

aegis::gateway::objects::message::message ( const std::string &  content,
aegis::channel _channel,
aegis::guild _guild 
)
explicitnoexcept

Constructor for the message object.

Parameters
contentString of the message sent
_channelPointer of channel object
_guildPointer of guild object
aegis::gateway::objects::message::message ( const std::string &  _json,
aegis::core _core 
)
noexcept

Constructor for the message object.

Parameters
_jsonJSON string of the message object
botPointer of core object
aegis::gateway::objects::message::message ( const nlohmann::json &  _json,
aegis::core _core 
)
noexcept

Constructor for the message object.

Parameters
_jsonJSON object of the message object
_corePointer of core object
aegis::gateway::objects::message::message ( aegis::core _core)
noexcept

Constructor for the message object.

Parameters
_corePointer of core object

Member Function Documentation

aegis::future< rest::rest_reply > aegis::gateway::objects::message::create_reaction ( const std::string &  content)

Add a reaction to this message.

Parameters
contentString of the emoji to add. Unicode emoji or emojiname:emoji_id
Returns
aegis::future<rest::rest_reply>
aegis::future< rest::rest_reply > aegis::gateway::objects::message::delete_all_reactions ( )

Delete all reactions on this message (not available for DMs)

Returns
aegis::future<rest::rest_reply>
aegis::future< rest::rest_reply > aegis::gateway::objects::message::delete_message ( )

Delete this message.

Returns
aegis::future<rest::rest_reply>
aegis::future< rest::rest_reply > aegis::gateway::objects::message::delete_own_reaction ( const std::string &  content)

Delete your reaction to this message.

Parameters
contentString of the emoji to set. Unicode emoji or emojiname:emoji_id
Returns
aegis::future<rest::rest_reply>
aegis::future< rest::rest_reply > aegis::gateway::objects::message::delete_user_reaction ( const std::string &  content,
const snowflake  member_id 
)

Delete other user reaction to this message (not available for DMs)

Parameters
contentString of the emoji to set. Unicode emoji or emojiname:emoji_id
member_idSnowflake of the member to delete the reaction for
Returns
aegis::future<rest::rest_reply>
aegis::future< message > aegis::gateway::objects::message::edit ( const std::string &  content)

Edit this message.

Parameters
contentString to set the new content to
Returns
aegis::future<message>
aegis::future< message > aegis::gateway::objects::message::edit ( edit_message_t obj)

Edit this message.

See also
edit_message_t
Parameters
objStruct of the edit message request
Returns
aegis::future<message>
snowflake aegis::gateway::objects::message::get_author_id ( ) const
noexcept

Get the Member ID of the author of the message.

Returns
aegis::snowflake
aegis::channel & aegis::gateway::objects::message::get_channel ( )

Get a reference to the channel object this message was sent in.

Returns
aegis::channel
snowflake aegis::gateway::objects::message::get_channel_id ( ) const
noexcept

Get the Channel ID of the message.

Returns
aegis::snowflake
const std::string& aegis::gateway::objects::message::get_content ( ) const
noexcept

Get a reference to the content of the message.

Returns
const std::string &
aegis::guild & aegis::gateway::objects::message::get_guild ( )

Get a reference to the guild object this message was sent in.

Returns
aegis::guild
snowflake aegis::gateway::objects::message::get_guild_id ( ) const
noexcept

Get the Guild ID of the message.

Returns
aegis::snowflake
snowflake aegis::gateway::objects::message::get_id ( ) const
noexcept

Get the ID of the message.

Returns
aegis::snowflake
std::tuple<snowflake, snowflake, snowflake, snowflake> aegis::gateway::objects::message::get_related_ids ( ) const
noexcept

Obtain the relevant snowflakes related to this message.

Returns { channel_id, guild_id, message_id, author_id } Some may be 0 such as guild for a DM or author for a webhook

Returns
std::tuple<aegis::snowflake, aegis::snowflake, aegis::snowflake, aegis::snowflake>
aegis::user & aegis::gateway::objects::message::get_user ( )

Get a reference to the user object this message was sent by.

Returns
aegis::user
bool aegis::gateway::objects::message::has_channel ( ) const
noexcept

Whether the message has a valid channel set.

Returns
bool
bool aegis::gateway::objects::message::has_guild ( ) const
noexcept

Whether the message has a valid guild set. The result of this function does not determine whether the object was a DM or not

See also
is_dm
Returns
bool
bool aegis::gateway::objects::message::has_member ( ) const
noexcept

Whether the message has a valid member set.

Returns
bool
bool aegis::gateway::objects::message::is_bot ( ) const
noexcept

Whether message is from a bot.

Returns
bool
bool aegis::gateway::objects::message::is_dm ( ) const
noexcept

Whether message is a Direct Message.

Returns
bool
bool aegis::gateway::objects::message::is_webhook ( ) const
noexcept

Whether message is from a webhook.

Returns
bool
void aegis::gateway::objects::message::set_channel ( aegis::channel _channel)

Set the channel of the message object. This is mostly an internal function though is left public for lower level use

Parameters
_channelPointer of the channel to assign the message to
void aegis::gateway::objects::message::set_content ( const std::string &  content)
noexcept

Set the message's content.

Parameters
contentString of content to set
void aegis::gateway::objects::message::set_guild ( aegis::guild _guild)

Set the guild of the message object. This is mostly an internal function though is left public for lower level use

Parameters
_guildPointer of the guild to assign the message to

Member Data Documentation

std::vector<objects::attachment> aegis::gateway::objects::message::attachments
Todo:
Needs documentation
user aegis::gateway::objects::message::author

author object for this message

std::string aegis::gateway::objects::message::edited_timestamp
Todo:
Needs documentation
std::vector<objects::embed> aegis::gateway::objects::message::embeds
Todo:
Needs documentation
bool aegis::gateway::objects::message::mention_everyone = false
Todo:
Needs documentation
std::vector<snowflake> aegis::gateway::objects::message::mention_roles
Todo:
Needs documentation
std::vector<snowflake> aegis::gateway::objects::message::mentions
Todo:
Needs documentation
snowflake aegis::gateway::objects::message::nonce
Todo:
Needs documentation
bool aegis::gateway::objects::message::pinned = false
Todo:
Needs documentation
std::vector<objects::reaction> aegis::gateway::objects::message::reactions
Todo:
Needs documentation
std::string aegis::gateway::objects::message::timestamp
Todo:
Needs documentation
bool aegis::gateway::objects::message::tts = false
Todo:
Needs documentation
objects::message_type aegis::gateway::objects::message::type = Default
Todo:
Needs documentation
std::string aegis::gateway::objects::message::webhook_id
Todo:
Needs documentation

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