Class for performing actions pertaining to a specified channel. More...
#include <channel.hpp>
Public Member Functions | |
channel (const snowflake channel_id, const snowflake guild_id, core *_bot, asio::io_context &_io, ratelimit::ratelimit_mgr &_ratelimit) | |
Constructor for the channel object. More... | |
guild & | get_guild () const |
Get a reference to the guild object this channel belongs to. More... | |
guild & | get_guild (std::error_code &ec) const noexcept |
Get a reference to the guild object this channel belongs to. More... | |
std::string | get_name () const noexcept |
Get channel name. More... | |
gateway::objects::channel::channel_type | get_type () const noexcept |
Get the type of this channel. More... | |
permission | perms () const noexcept |
Get bot's permission for this channel. More... | |
aegis::future < gateway::objects::message > | create_message (const std::string &content, int64_t nonce=0) |
Send message to this channel. More... | |
aegis::future < gateway::objects::message > | create_message (create_message_t obj) |
Send message to this channel. More... | |
aegis::future < gateway::objects::message > | create_message_embed (const std::string &content, const json &embed, int64_t nonce=0) |
Send an embed message to this channel. More... | |
aegis::future < gateway::objects::message > | create_message_embed (create_message_t obj) |
Send an embed message to this channel. More... | |
aegis::future < gateway::objects::message > | get_message (snowflake message_id) |
Get message from this channel. More... | |
aegis::future < gateway::objects::messages > | get_messages (get_messages_t obj) |
Get multiple messages from this channel. More... | |
aegis::future < gateway::objects::message > | edit_message (snowflake message_id, const std::string &content) |
Edit a message in this channel. More... | |
aegis::future < gateway::objects::message > | edit_message (edit_message_t obj) |
Edit a message in this channel. More... | |
aegis::future < gateway::objects::message > | edit_message_embed (snowflake message_id, const std::string &content, const json &embed) |
Edit an embed message in this channel. More... | |
aegis::future < gateway::objects::message > | edit_message_embed (edit_message_t obj) |
Edit an embed message in this channel. More... | |
aegis::future< rest::rest_reply > | delete_message (snowflake message_id) |
Delete a message. More... | |
aegis::future< rest::rest_reply > | bulk_delete_message (const std::vector< int64_t > &messages) |
Delete up to 100 messages at once. More... | |
aegis::future< rest::rest_reply > | bulk_delete_message (const std::vector< snowflake > &messages) |
Delete up to 100 messages at once. More... | |
aegis::future < gateway::objects::channel > | modify_channel (lib::optional< std::string > _name={}, lib::optional< int > _position={}, lib::optional< std::string > _topic={}, lib::optional< bool > _nsfw={}, lib::optional< int > _bitrate={}, lib::optional< int > _user_limit={}, lib::optional< std::vector< gateway::objects::permission_overwrite >> _permission_overwrites={}, lib::optional< snowflake > _parent_id={}, lib::optional< int > _rate_limit_per_user={}) |
Modify this channel (all parameters optional) More... | |
aegis::future < gateway::objects::channel > | modify_channel (modify_channel_t obj) |
Modify this channel (all parameters optional) More... | |
aegis::future< rest::rest_reply > | delete_channel () |
Delete this channel. More... | |
aegis::future< rest::rest_reply > | create_reaction (snowflake message_id, const std::string &emoji_text) |
Add new reaction on message. More... | |
aegis::future< rest::rest_reply > | create_reaction (create_reaction_t obj) |
Add new reaction on message. More... | |
aegis::future< rest::rest_reply > | delete_own_reaction (snowflake message_id, const std::string &emoji_text) |
Delete own reaction on message. More... | |
aegis::future< rest::rest_reply > | delete_own_reaction (delete_own_reaction_t obj) |
Delete own reaction on message. More... | |
aegis::future< rest::rest_reply > | delete_user_reaction (snowflake message_id, const std::string &emoji_text, snowflake member_id) |
Delete specified member reaction on message. More... | |
aegis::future< rest::rest_reply > | delete_user_reaction (delete_user_reaction_t obj) |
Delete specified member reaction on message. More... | |
aegis::future< rest::rest_reply > | get_reactions (snowflake message_id, const std::string &emoji_text) |
Get all reactions for this message. More... | |
aegis::future< rest::rest_reply > | get_reactions (get_reactions_t obj) |
Get all reactions for this message. More... | |
aegis::future< rest::rest_reply > | delete_all_reactions (snowflake message_id) |
Delete all reactions by message. More... | |
aegis::future< rest::rest_reply > | edit_channel_permissions (snowflake _overwrite_id, int64_t _allow, int64_t _deny, const std::string &_type) |
Edit channel permission override. More... | |
aegis::future< rest::rest_reply > | edit_channel_permissions (edit_channel_permissions_t obj) |
Edit channel permission override. More... | |
aegis::future< rest::rest_reply > | get_channel_invites () |
Get active channel invites. More... | |
aegis::future< rest::rest_reply > | create_channel_invite (const lib::optional< int > max_age, const lib::optional< int > max_uses, const lib::optional< bool > temporary, const lib::optional< bool > unique) |
Create a new channel invite. More... | |
aegis::future< rest::rest_reply > | create_channel_invite (create_channel_invite_t obj) |
Create a new channel invite. More... | |
aegis::future< rest::rest_reply > | delete_channel_permission (snowflake overwrite_id) |
Delete channel permission override. More... | |
aegis::future< rest::rest_reply > | trigger_typing_indicator () |
Trigger typing indicator in channel (lasts 10 seconds) More... | |
aegis::future< rest::rest_reply > | get_pinned_messages () |
Get pinned messages in channel. More... | |
aegis::future< rest::rest_reply > | add_pinned_channel_message (snowflake message_id) |
Add a pinned message in channel. More... | |
aegis::future< rest::rest_reply > | delete_pinned_channel_message (snowflake message_id) |
Delete a pinned message in channel. More... | |
aegis::future< rest::rest_reply > | group_dm_add_recipient (snowflake user_id) |
Add member to a group direct message. More... | |
aegis::future< rest::rest_reply > | group_dm_remove_recipient (snowflake user_id) |
Remove member from a group direct message. More... | |
aegis::channel * | get_parent () const |
Get parent channel. More... | |
aegis::snowflake | get_parent_id () const noexcept |
Get parent channel snowflake. More... | |
snowflake | get_id () const noexcept |
Get the aegis::snowflake of this channel. More... | |
snowflake | get_guild_id () const noexcept |
Get the snowflake of this channel's guild - 0 if DM. More... | |
bool | is_dm () const noexcept |
Is this channel a DM or in a guild. More... | |
shared_mutex & | mtx () const noexcept |
Get the mutex for the channel. More... | |
bool | nsfw () const noexcept |
Get if this channel is set to NSFW. More... | |
Friends | |
class | guild |
class | core |
Class for performing actions pertaining to a specified channel.
aegis::channel::channel | ( | const snowflake | channel_id, |
const snowflake | guild_id, | ||
core * | _bot, | ||
asio::io_context & | _io, | ||
ratelimit::ratelimit_mgr & | _ratelimit | ||
) |
Constructor for the channel object.
channel_id | Snowflake of this channel |
guild_id | Snowflake of guild this channel belongs to |
_bot | Pointer to the core lib instance |
_io | Reference to asio::io_context for the bot |
ratelimit | Reference to bucket factory that manages rate limits for this channel |
aegis::future< rest::rest_reply > aegis::channel::add_pinned_channel_message | ( | snowflake | message_id | ) |
Add a pinned message in channel.
aegis::future< rest::rest_reply > aegis::channel::bulk_delete_message | ( | const std::vector< int64_t > & | messages | ) |
Delete up to 100 messages at once.
message | Vector of up to 100 message int64_t to delete |
aegis::future< rest::rest_reply > aegis::channel::bulk_delete_message | ( | const std::vector< snowflake > & | messages | ) |
Delete up to 100 messages at once.
message | Vector of up to 100 message snowflakes to delete |
aegis::future< rest::rest_reply > aegis::channel::create_channel_invite | ( | const lib::optional< int > | max_age, |
const lib::optional< int > | max_uses, | ||
const lib::optional< bool > | temporary, | ||
const lib::optional< bool > | unique | ||
) |
Create a new channel invite.
max_age | How long this invite code lasts for in seconds |
max_uses | The max uses this invite code allows |
temporary | Is this invite code temporary |
unique | Is this invite code a unique one-use |
aegis::future<rest::rest_reply> aegis::channel::create_channel_invite | ( | create_channel_invite_t | obj | ) |
Create a new channel invite.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::message > aegis::channel::create_message | ( | const std::string & | content, |
int64_t | nonce = 0 |
||
) |
Send message to this channel.
content | A string of the message to send |
aegis::future< aegis::gateway::objects::message > aegis::channel::create_message | ( | create_message_t | obj | ) |
Send message to this channel.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::message > aegis::channel::create_message_embed | ( | const std::string & | content, |
const json & | embed, | ||
int64_t | nonce = 0 |
||
) |
Send an embed message to this channel.
content | A string of the message to send |
embed | A json object of the embed object itself |
aegis::future< gateway::objects::message > aegis::channel::create_message_embed | ( | create_message_t | obj | ) |
Send an embed message to this channel.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::channel::create_reaction | ( | snowflake | message_id, |
const std::string & | emoji_text | ||
) |
Add new reaction on message.
message_id | Snowflake of message |
emoji_text | Text of emoji being added name:snowflake |
aegis::future<rest::rest_reply> aegis::channel::create_reaction | ( | create_reaction_t | obj | ) |
Add new reaction on message.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::channel::delete_all_reactions | ( | snowflake | message_id | ) |
Delete all reactions by message.
message_id | Snowflake of message |
aegis::future< rest::rest_reply > aegis::channel::delete_channel | ( | ) |
Delete this channel.
aegis::future< rest::rest_reply > aegis::channel::delete_channel_permission | ( | snowflake | overwrite_id | ) |
Delete channel permission override.
overwrite_id | Snowflake of the channel permission to delete |
aegis::future< rest::rest_reply > aegis::channel::delete_message | ( | snowflake | message_id | ) |
Delete a message.
message_id | Snowflake of the message to delete |
can delete your own messages freely - provide separate function or keep history of messages? message::delete() can determine if author is bot for self-delete
aegis::future< rest::rest_reply > aegis::channel::delete_own_reaction | ( | snowflake | message_id, |
const std::string & | emoji_text | ||
) |
Delete own reaction on message.
message_id | Snowflake of message |
emoji_text | Text of emoji being added name:snowflake |
aegis::future<rest::rest_reply> aegis::channel::delete_own_reaction | ( | delete_own_reaction_t | obj | ) |
Delete own reaction on message.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::channel::delete_pinned_channel_message | ( | snowflake | message_id | ) |
Delete a pinned message in channel.
aegis::future< rest::rest_reply > aegis::channel::delete_user_reaction | ( | snowflake | message_id, |
const std::string & | emoji_text, | ||
snowflake | member_id | ||
) |
Delete specified member reaction on message.
message_id | Snowflake of message |
emoji_text | Text of emoji being added name:snowflake |
member_id | Snowflake of member to remove emoji from |
aegis::future<rest::rest_reply> aegis::channel::delete_user_reaction | ( | delete_user_reaction_t | obj | ) |
Delete specified member reaction on message.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::channel::edit_channel_permissions | ( | snowflake | _overwrite_id, |
int64_t | _allow, | ||
int64_t | _deny, | ||
const std::string & | _type | ||
) |
Edit channel permission override.
_overwrite_id | Snowflake of the permission override |
_allow | Int64 allow flags |
_deny | Int64 deny flags |
_type | Type of override (role/user) |
aegis::future<rest::rest_reply> aegis::channel::edit_channel_permissions | ( | edit_channel_permissions_t | obj | ) |
Edit channel permission override.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::message > aegis::channel::edit_message | ( | snowflake | message_id, |
const std::string & | content | ||
) |
Edit a message in this channel.
message_id | Snowflake of the message to replace. Must be your own message |
content | A string of the message to set |
aegis::future< gateway::objects::message > aegis::channel::edit_message | ( | edit_message_t | obj | ) |
Edit a message in this channel.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::message > aegis::channel::edit_message_embed | ( | snowflake | message_id, |
const std::string & | content, | ||
const json & | embed | ||
) |
Edit an embed message in this channel.
message_id | Snowflake of the message to replace. Must be your own message |
content | A string of the message to set |
embed | A json object of the embed object itself |
aegis::future< gateway::objects::message > aegis::channel::edit_message_embed | ( | edit_message_t | obj | ) |
Edit an embed message in this channel.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::channel::get_channel_invites | ( | ) |
Get active channel invites.
guild & aegis::channel::get_guild | ( | ) | const |
Get a reference to the guild object this channel belongs to.
aegis::exception | Thrown on failure. |
|
noexcept |
Get a reference to the guild object this channel belongs to.
|
noexcept |
Get the snowflake of this channel's guild - 0 if DM.
|
noexcept |
Get the aegis::snowflake of this channel.
aegis::future< gateway::objects::message > aegis::channel::get_message | ( | snowflake | message_id | ) |
Get message from this channel.
message_id | Snowflake of the message to retrieve |
aegis::future< gateway::objects::messages > aegis::channel::get_messages | ( | get_messages_t | obj | ) |
Get multiple messages from this channel.
obj | Struct of the request |
|
noexcept |
Get channel name.
aegis::channel* aegis::channel::get_parent | ( | ) | const |
Get parent channel.
|
noexcept |
Get parent channel snowflake.
aegis::future< rest::rest_reply > aegis::channel::get_pinned_messages | ( | ) |
Get pinned messages in channel.
aegis::future< rest::rest_reply > aegis::channel::get_reactions | ( | snowflake | message_id, |
const std::string & | emoji_text | ||
) |
Get all reactions for this message.
message_id | Snowflake of message |
emoji_text | Text of emoji being added name:snowflake |
Support query parameters
before[snowflake], after[snowflake], limit[int]
aegis::future<rest::rest_reply> aegis::channel::get_reactions | ( | get_reactions_t | obj | ) |
Get all reactions for this message.
obj | Struct of the contents of the request |
|
noexcept |
Get the type of this channel.
aegis::future< rest::rest_reply > aegis::channel::group_dm_add_recipient | ( | snowflake | user_id | ) |
Add member to a group direct message.
aegis::future< rest::rest_reply > aegis::channel::group_dm_remove_recipient | ( | snowflake | user_id | ) |
Remove member from a group direct message.
|
noexcept |
Is this channel a DM or in a guild.
aegis::future< gateway::objects::channel > aegis::channel::modify_channel | ( | lib::optional< std::string > | _name = {} , |
lib::optional< int > | _position = {} , |
||
lib::optional< std::string > | _topic = {} , |
||
lib::optional< bool > | _nsfw = {} , |
||
lib::optional< int > | _bitrate = {} , |
||
lib::optional< int > | _user_limit = {} , |
||
lib::optional< std::vector< gateway::objects::permission_overwrite >> | _permission_overwrites = {} , |
||
lib::optional< snowflake > | _parent_id = {} , |
||
lib::optional< int > | _rate_limit_per_user = {} |
||
) |
Modify this channel (all parameters optional)
_name | String of channel name |
_position | Integer of position on channel list |
_topic | String of channel topic |
_nsfw | Boolean of whether channel is NSFW or not |
_bitrate | Integer of the channel bitrate (VOICE CHANNEL ONLY) |
_user_limit | Integer of the channel max user limit (VOICE CHANNEL ONLY) |
_permission_overwrites | Vector of permission_overwrite objects for overriding permissions |
_parent_id | Snowflake of category channel belongs in (empty parent puts channel in no category) |
aegis::future<gateway::objects::channel> aegis::channel::modify_channel | ( | modify_channel_t | obj | ) |
Modify this channel (all parameters optional)
obj | Struct of the contents of the request |
|
noexcept |
Get the mutex for the channel.
|
noexcept |
Get if this channel is set to NSFW.
|
noexcept |
Get bot's permission for this channel.
permission
object aegis::future< rest::rest_reply > aegis::channel::trigger_typing_indicator | ( | ) |
Trigger typing indicator in channel (lasts 10 seconds)