D++ (DPP)
C++ Discord API Bot Library
|
The cluster class represents a group of shards and a command queue for sending and receiving commands from discord via HTTP. You should usually instantiate a cluster object at the very least to make use of the library. More...
#include <cluster.h>
Public Member Functions | |
cluster (const std::string &token, uint32_t intents=i_default_intents, uint32_t shards=0, uint32_t cluster_id=0, uint32_t maxclusters=1, bool compressed=true, cache_policy_t policy={cp_aggressive, cp_aggressive, cp_aggressive}) | |
Constructor for creating a cluster. All but the token are optional. More... | |
cluster (const cluster &)=delete | |
dpp::cluster is non-copyable More... | |
cluster (const cluster &&)=delete | |
dpp::cluster is non-moveable More... | |
~cluster () | |
void | log (dpp::loglevel severity, const std::string &msg) const |
Log a message to whatever log the user is using. The logged message is passed up the chain to the on_log event in user code which can then do whatever it wants to do with it. More... | |
snowflake | get_dm_channel (snowflake user_id) |
Get the dm channel for a user id. More... | |
void | set_dm_channel (snowflake user_id, snowflake channel_id) |
Set the dm channel id for a user id. More... | |
dpp::utility::uptime | uptime () |
Returns the uptime of the cluster. More... | |
void | start (bool return_after=true) |
Start the cluster, connecting all its shards. Returns once all shards are connected. More... | |
void | set_presence (const class dpp::presence &p) |
Set the presence for all shards on the cluster. More... | |
discord_client * | get_shard (uint32_t id) |
Get a shard by id, returning the discord_client. More... | |
const shard_list & | get_shards () |
Get the list of shards. More... | |
void | on_voice_state_update (std::function< void(const voice_state_update_t &_event)> _voice_state_update) |
on voice state update event More... | |
void | on_voice_client_disconnect (std::function< void(const voice_client_disconnect_t &_event)> _voice_client_disconnect) |
on voice client disconnect event More... | |
void | on_voice_client_speaking (std::function< void(const voice_client_speaking_t &_event)> _voice_client_speaking) |
on voice client speaking event More... | |
void | on_log (std::function< void(const log_t &_event)> _log) |
Called when a log message is to be written to the log. You can attach any logging system here you wish, e.g. spdlog, or even just a simple use of std::cout or printf. If nothing attaches this log event, then the library will be silent. More... | |
void | on_guild_join_request_delete (std::function< void(const guild_join_request_delete_t &_event)> _guild_join_request_delete) |
on guild join request delete. Triggered when a user declines the membership screening questionnaire for a guild. More... | |
void | on_interaction_create (std::function< void(const interaction_create_t &_event)> _interaction_create) |
Called when a new interaction is created. Interactions are created by discord when commands you have registered are issued by a user. For an example of this in action please see Using Slash Commands and Interactions. More... | |
void | on_button_click (std::function< void(const button_click_t &_event)> _button_click) |
Called when a button is clicked attached to a message. Button clicks are triggered by discord when buttons are clicked which you have associated with a message using dpp::component. More... | |
void | on_select_click (std::function< void(const select_click_t &_event)> _select_click) |
Called when a select menu is clicked attached to a message. Select menu clicks are triggered by discord when select menus are clicked which you have associated with a message using dpp::component. More... | |
void | on_guild_delete (std::function< void(const guild_delete_t &_event)> _guild_delete) |
Called when a guild is deleted. A guild can be deleted via the bot being kicked, the bot leaving the guild explicitly with dpp::guild_delete, or via the guild being unavaialble due to an outage. More... | |
void | on_channel_delete (std::function< void(const channel_delete_t &_event)> _channel_delete) |
Called when a channel is deleted from a guild. The channel will still be temporarily avaialble in the cache. Pointers to the channel should not be retained long-term as they will be deleted by the garbage collector. More... | |
void | on_channel_update (std::function< void(const channel_update_t &_event)> _channel_update) |
Called when a channel is edited on a guild. The new channel details have already been applied to the guild when you receive this event. More... | |
void | on_ready (std::function< void(const ready_t &_event)> _ready) |
Called when a shard is connected and ready. A set of on_guild_create events will follow this event. More... | |
void | on_message_delete (std::function< void(const message_delete_t &_event)> _message_delete) |
Called when a message is deleted. The message has already been deleted from Discord when you receive this event. More... | |
void | on_application_command_delete (std::function< void(const application_command_delete_t &_event)> _application_command_delete) |
Called when an application command (slash command) is deleted. More... | |
void | on_guild_member_remove (std::function< void(const guild_member_remove_t &_event)> _guild_member_remove) |
Called when a user leaves a guild (either through being kicked, or choosing to leave) More... | |
void | on_application_command_create (std::function< void(const application_command_create_t &_event)> _application_command_create) |
Called when a new application command (slash command) is registered. More... | |
void | on_resumed (std::function< void(const resumed_t &_event)> _resumed) |
Called when a connection to a shard successfully resumes. A resumed session does not need to re-synchronise guilds, members, etc. This is generally non-fatal and informational only. More... | |
void | on_guild_role_create (std::function< void(const guild_role_create_t &_event)> _guild_role_create) |
Called when a new role is created on a guild. More... | |
void | on_typing_start (std::function< void(const typing_start_t &_event)> _typing_start) |
Called when a user is typing on a channel. More... | |
void | on_message_reaction_add (std::function< void(const message_reaction_add_t &_event)> _message_reaction_add) |
Called when a new reaction is added to a message. More... | |
void | on_guild_members_chunk (std::function< void(const guild_members_chunk_t &_event)> _guild_members_chunk) |
Called when a set of members is received for a guild. D++ will request these for all new guilds if needed, after the on_guild_create events. More... | |
void | on_message_reaction_remove (std::function< void(const message_reaction_remove_t &_event)> _message_reaction_remove) |
Called when a single reaction is removed from a message. More... | |
void | on_guild_create (std::function< void(const guild_create_t &_event)> _guild_create) |
Called when a new guild is created. D++ will request members for the guild for its cache using guild_members_chunk. More... | |
void | on_channel_create (std::function< void(const channel_create_t &_event)> _channel_create) |
Called when a new channel is created on a guild. More... | |
void | on_message_reaction_remove_emoji (std::function< void(const message_reaction_remove_emoji_t &_event)> _message_reaction_remove_emoji) |
Called when all reactions for a particular emoji are removed from a message. More... | |
void | on_message_delete_bulk (std::function< void(const message_delete_bulk_t &_event)> _message_delete_bulk) |
Called when multiple messages are deleted from a channel or DM. More... | |
void | on_guild_role_update (std::function< void(const guild_role_update_t &_event)> _guild_role_update) |
Called when an existing role is updated on a guild. More... | |
void | on_guild_role_delete (std::function< void(const guild_role_delete_t &_event)> _guild_role_delete) |
Called when a role is deleted in a guild. More... | |
void | on_channel_pins_update (std::function< void(const channel_pins_update_t &_event)> _channel_pins_update) |
Called when a message is pinned. Note that the pinned message is not returned to this event, just the timestamp of the last pinned message. More... | |
void | on_message_reaction_remove_all (std::function< void(const message_reaction_remove_all_t &_event)> _message_reaction_remove_all) |
Called when all reactions are removed from a message. More... | |
void | on_voice_server_update (std::function< void(const voice_server_update_t &_event)> _voice_server_update) |
Called when we are told which voice server we can use. This will be sent either when we establish a new voice channel connection, or as discord rearrange their infrastructure. More... | |
void | on_guild_emojis_update (std::function< void(const guild_emojis_update_t &_event)> _guild_emojis_update) |
Called when new emojis are added to a guild. The complete set of emojis is sent every time. More... | |
void | on_guild_stickers_update (std::function< void(const guild_stickers_update_t &_event)> _guild_stickers_update) |
Called when new stickers are added to a guild. The complete set of stickers is sent every time. More... | |
void | on_presence_update (std::function< void(const presence_update_t &_event)> _presence_update) |
Called when a user's presence is updated. To receive these you will need the GUILD_PRESENCES privileged intent. You will receive many of these, very often, and receiving them will significaintly increase your bot's CPU usage. If you don't need them it is recommended to not ask for them. More... | |
void | on_webhooks_update (std::function< void(const webhooks_update_t &_event)> _webhooks_update) |
Called when the webhooks for a guild are updated. More... | |
void | on_guild_member_add (std::function< void(const guild_member_add_t &_event)> _guild_member_add) |
Called when a new member joins a guild. More... | |
void | on_invite_delete (std::function< void(const invite_delete_t &_event)> _invite_delete) |
Called when an invite is deleted from a guild. More... | |
void | on_guild_update (std::function< void(const guild_update_t &_event)> _guild_update) |
Called when details of a guild are updated. More... | |
void | on_guild_integrations_update (std::function< void(const guild_integrations_update_t &_event)> _guild_integrations_update) |
Called when an integration is updated for a guild. This returns the complete list. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc. More... | |
void | on_guild_member_update (std::function< void(const guild_member_update_t &_event)> _guild_member_update) |
Called when details of a guild member (e.g. their roles or nickname) are updated. More... | |
void | on_application_command_update (std::function< void(const application_command_update_t &_event)> _application_command_update) |
Called when an application command (slash command) is updated. You will only receive this event for application commands that belong to your bot/application. More... | |
void | on_invite_create (std::function< void(const invite_create_t &_event)> _invite_create) |
Called when a new invite is created for a guild. More... | |
void | on_message_update (std::function< void(const message_update_t &_event)> _message_update) |
Called when a message is updated (edited). More... | |
void | on_user_update (std::function< void(const user_update_t &_event)> _user_update) |
Called when a user is updated. This is separate to guild_member_update and includes things such as an avatar change, username change, discriminator change or change in subscription status for nitro. More... | |
void | on_message_create (std::function< void(const message_create_t &_event)> _message_create) |
Called when a new message arrives from discord. Note that D++ does not cache messages. If you want to cache these objects you should create something yourself within your bot. Caching of messages is not on the roadmap to be supported as it consumes excessive amounts of RAM. More... | |
void | on_guild_ban_add (std::function< void(const guild_ban_add_t &_event)> _guild_ban_add) |
Called when a ban is added to a guild. More... | |
void | on_guild_ban_remove (std::function< void(const guild_ban_remove_t &_event)> _guild_ban_remove) |
Called when a ban is removed from a guild. More... | |
void | on_integration_create (std::function< void(const integration_create_t &_event)> _integration_create) |
Called when a new intgration is attached to a guild by a user. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc. More... | |
void | on_integration_update (std::function< void(const integration_update_t &_event)> _integration_update) |
Called when an integration is updated by a user. This returns details of just the single integration that has changed. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc. More... | |
void | on_integration_delete (std::function< void(const integration_delete_t &_event)> _integration_delete) |
Called when an integration is removed by a user. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc. More... | |
void | on_thread_create (std::function< void(const thread_create_t &_event)> _thread_create) |
Called when a thread is created Note: Threads are not cached by D++, but a list of thread IDs is accessible in a guild object. More... | |
void | on_thread_update (std::function< void(const thread_update_t &_event)> _thread_update) |
Called when a thread is updated. More... | |
void | on_thread_delete (std::function< void(const thread_delete_t &_event)> _thread_delete) |
Called when a thread is deleted. More... | |
void | on_thread_list_sync (std::function< void(const thread_list_sync_t &_event)> _thread_list_sync) |
Called when thread list is synced (upon gaining access to a channel) Note: Threads are not cached by D++, but a list of thread IDs is accessible in a guild object. More... | |
void | on_thread_member_update (std::function< void(const thread_member_update_t &_event)> _thread_member_update) |
Called when current user's thread member object is updated. More... | |
void | on_thread_members_update (std::function< void(const thread_members_update_t &_event)> _thread_members_update) |
Called when a thread's member list is updated (without GUILD_MEMBERS intent, is only called for current user) More... | |
void | on_voice_buffer_send (std::function< void(const voice_buffer_send_t &_event)> _voice_buffer_send) |
Called when packets are sent from the voice buffer. The voice buffer contains packets that are already encoded with Opus and encrypted with Sodium, and merged into packets by the repacketizer, which is done in the dpp::discord_voice_client::send_audio method. You should use the buffer size properties of dpp::voice_buffer_send_t to determine if you should fill the buffer with more content. More... | |
void | on_voice_user_talking (std::function< void(const voice_user_talking_t &_event)> _voice_user_talking) |
Called when a user is talking on a voice channel. More... | |
void | on_voice_ready (std::function< void(const voice_ready_t &_event)> _voice_ready) |
Called when a voice channel is connected and ready to send audio. Note that this is not directly attached to the READY event of the websocket, as there is further connection that needs to be done before audio is ready to send. More... | |
void | on_voice_receive (std::function< void(const voice_receive_t &_event)> _voice_receive) |
Called when new audio data is received. Each separate user's audio from the voice channel will arrive tagged with their user id in the event, if a user can be attributed to the received audio. More... | |
void | on_voice_track_marker (std::function< void(const voice_track_marker_t &_event)> _voice_track_marker) |
Called when sending of audio passes over a track marker. Track markers are arbitrarily placed "bookmarks" in the audio buffer, placed by the bot developer. Each track marker can have a string value associated with it which is specified in dpp::discord_voice_client::insert_marker and returned to this event. More... | |
void | on_stage_instance_create (std::function< void(const stage_instance_create_t &_event)> _stage_instance_create) |
Called when a new stage instance is created on a stage channel. More... | |
void | on_stage_instance_delete (std::function< void(const stage_instance_delete_t &_event)> _stage_instance_delete) |
Called when an existing stage instance is deleted from a stage channel. More... | |
void | post_rest (const std::string &endpoint, const std::string &major_parameters, const std::string ¶meters, http_method method, const std::string &postdata, json_encode_t callback, const std::string &filename="", const std::string &filecontent="") |
Post a REST request. Where possible use a helper method instead like message_create. More... | |
void | request (const std::string &url, http_method method, http_completion_event callback, const std::string &postdata="", const std::string &mimetype="text/plain", const std::multimap< std::string, std::string > &headers={}) |
Make a HTTP(S) request. For use when wanting asnyncronous access to HTTP APIs outside of Discord. More... | |
void | interaction_response_create (snowflake interaction_id, const std::string &token, const interaction_response &r, command_completion_event_t callback={}) |
Respond to a slash command. More... | |
void | interaction_response_edit (const std::string &token, const message &r, command_completion_event_t callback={}) |
Respond to a slash command. More... | |
void | global_command_create (slashcommand &s, command_completion_event_t callback={}) |
Create a global slash command (a bot can have a maximum of 100 of these) More... | |
void | guild_auditlog_get (snowflake guild_id, command_completion_event_t callback) |
Get the audit log for a guild. More... | |
void | guild_command_create (slashcommand &s, snowflake guild_id, command_completion_event_t callback={}) |
Create a slash command local to a guild. More... | |
void | guild_bulk_command_create (const std::vector< slashcommand > &commands, snowflake guild_id, command_completion_event_t callback={}) |
Create/overwrite guild slash commands. More... | |
void | global_bulk_command_create (const std::vector< slashcommand > &commands, command_completion_event_t callback={}) |
Create/overwrite global slash commands. More... | |
void | global_command_edit (const slashcommand &s, command_completion_event_t callback={}) |
Edit a global slash command (a bot can have a maximum of 100 of these) More... | |
void | guild_command_edit (const slashcommand &s, snowflake guild_id, command_completion_event_t callback={}) |
Edit a slash command local to a guild. More... | |
void | guild_command_edit_permissions (const slashcommand &s, snowflake guild_id, command_completion_event_t callback={}) |
Edit slash command permissions local to a guild, permissions are read from s.permissions. More... | |
void | global_command_delete (snowflake id, command_completion_event_t callback={}) |
Delete a global slash command (a bot can have a maximum of 100 of these) More... | |
void | guild_command_delete (snowflake id, snowflake guild_id, command_completion_event_t callback={}) |
Delete a slash command local to a guild. More... | |
void | guild_commands_get (snowflake guild_id, command_completion_event_t callback) |
Get the application's slash commands for a guild. More... | |
void | global_commands_get (command_completion_event_t callback) |
Get the application's global slash commands. More... | |
void | direct_message_create (snowflake user_id, const message &m, command_completion_event_t callback={}) |
Create a direct message, also create the channel for the direct message if needed. More... | |
void | message_get (snowflake message_id, snowflake channel_id, command_completion_event_t callback) |
Get a message. More... | |
void | messages_get (snowflake channel_id, snowflake around, snowflake before, snowflake after, snowflake limit, command_completion_event_t callback) |
Get multiple messages. More... | |
void | message_create (const struct message &m, command_completion_event_t callback={}) |
Send a message to a channel. The callback function is called when the message has been sent. More... | |
void | message_crosspost (snowflake message_id, snowflake channel_id, command_completion_event_t callback={}) |
Crosspost a message. The callback function is called when the message has been sent. More... | |
void | message_edit (const struct message &m, command_completion_event_t callback={}) |
Edit a message on a channel. The callback function is called when the message has been edited. More... | |
void | message_add_reaction (const struct message &m, const std::string &reaction, command_completion_event_t callback={}) |
Add a reaction to a message. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_own_reaction (const struct message &m, const std::string &reaction, command_completion_event_t callback={}) |
Delete own reaction from a message. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_reaction (const struct message &m, snowflake user_id, const std::string &reaction, command_completion_event_t callback={}) |
Delete a user's reaction from a message. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_get_reactions (const struct message &m, const std::string &reaction, snowflake before, snowflake after, snowflake limit, command_completion_event_t callback) |
Get reactions on a message for a particular emoji. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_all_reactions (const struct message &m, command_completion_event_t callback={}) |
Delete all reactions on a message. More... | |
void | message_delete_reaction_emoji (const struct message &m, const std::string &reaction, command_completion_event_t callback={}) |
Delete all reactions on a message using a particular emoji. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_add_reaction (snowflake message_id, snowflake channel_id, const std::string &reaction, command_completion_event_t callback={}) |
Add a reaction to a message by id. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_own_reaction (snowflake message_id, snowflake channel_id, const std::string &reaction, command_completion_event_t callback={}) |
Delete own reaction from a message by id. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_reaction (snowflake message_id, snowflake channel_id, snowflake user_id, const std::string &reaction, command_completion_event_t callback={}) |
Delete a user's reaction from a message by id. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_get_reactions (snowflake message_id, snowflake channel_id, const std::string &reaction, snowflake before, snowflake after, snowflake limit, command_completion_event_t callback) |
Get reactions on a message for a particular emoji by id. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete_all_reactions (snowflake message_id, snowflake channel_id, command_completion_event_t callback={}) |
Delete all reactions on a message by id. More... | |
void | message_delete_reaction_emoji (snowflake message_id, snowflake channel_id, const std::string &reaction, command_completion_event_t callback={}) |
Delete all reactions on a message using a particular emoji by id. The reaction string must be either an emojiname:id or a unicode character. More... | |
void | message_delete (snowflake message_id, snowflake channel_id, command_completion_event_t callback={}) |
Delete a message from a channel. The callback function is called when the message has been edited. More... | |
void | message_delete_bulk (const std::vector< snowflake > &message_ids, snowflake channel_id, command_completion_event_t callback={}) |
Bulk delete messages from a channel. The callback function is called when the message has been edited. More... | |
void | channel_get (snowflake c, command_completion_event_t callback) |
Get a channel. More... | |
void | channels_get (snowflake guild_id, command_completion_event_t callback) |
Get all channels for a guild. More... | |
void | channel_create (const class channel &c, command_completion_event_t callback={}) |
Create a channel. More... | |
void | channel_edit (const class channel &c, command_completion_event_t callback={}) |
Edit a channel. More... | |
void | channel_edit_position (const class channel &c, command_completion_event_t callback={}) |
Edit a channel's position. More... | |
void | channel_edit_permissions (const class channel &c, snowflake overwrite_id, uint32_t allow, uint32_t deny, bool member, command_completion_event_t callback={}) |
Edit a channel's permissions. More... | |
void | channel_delete (snowflake channel_id, command_completion_event_t callback={}) |
Delete a channel. More... | |
void | invite_get (const std::string &invite, command_completion_event_t callback) |
Get details about an invite. More... | |
void | invite_delete (const std::string &invite, command_completion_event_t callback={}) |
Delete an invite. More... | |
void | channel_invites_get (const class channel &c, command_completion_event_t callback) |
Get invites for a channel. More... | |
void | channel_invite_create (const class channel &c, const class invite &i, command_completion_event_t callback={}) |
Create invite for a channel. More... | |
void | pins_get (snowflake channel_id, command_completion_event_t callback) |
Get a channel's pins. More... | |
void | gdm_add (snowflake channel_id, snowflake user_id, const std::string &access_token, const std::string &nick, command_completion_event_t callback={}) |
Adds a recipient to a Group DM using their access token. More... | |
void | gdm_remove (snowflake channel_id, snowflake user_id, command_completion_event_t callback={}) |
Removes a recipient from a Group DM. More... | |
void | channel_delete_permission (const class channel &c, snowflake overwrite_id, command_completion_event_t callback={}) |
Remove a permission from a channel. More... | |
void | channel_follow_news (const class channel &c, snowflake target_channel_id, command_completion_event_t callback={}) |
Follow a news channel. More... | |
void | channel_typing (const class channel &c, command_completion_event_t callback={}) |
Trigger channel typing indicator. More... | |
void | message_pin (snowflake channel_id, snowflake message_id, command_completion_event_t callback={}) |
Pin a message. More... | |
void | message_unpin (snowflake channel_id, snowflake message_id, command_completion_event_t callback={}) |
Unpin a message. More... | |
void | guild_get (snowflake g, command_completion_event_t callback) |
Get a guild. More... | |
void | guild_get_preview (snowflake g, command_completion_event_t callback) |
Get a guild preview. Returns a guild object but only a subset of the fields will be populated. More... | |
void | guild_get_member (snowflake guild_id, snowflake user_id, command_completion_event_t callback) |
Get a guild member. More... | |
void | guild_search_members (snowflake guild_id, const std::string &query, uint16_t limit, command_completion_event_t callback) |
Search for guild members based on whether their username or nickname starts with the given string. More... | |
void | guild_get_members (snowflake guild_id, uint16_t limit, snowflake after, command_completion_event_t callback) |
Get all guild members. More... | |
void | guild_add_member (const guild_member &gm, const std::string &access_token, command_completion_event_t callback={}) |
Add guild member. Needs a specific oauth2 scope, from which you get the access_token. More... | |
void | guild_edit_member (const guild_member &gm, command_completion_event_t callback={}) |
Edit the properties of an existing guild member. More... | |
void | guild_member_move (const snowflake channel_id, const snowflake guild_id, const snowflake user_id, command_completion_event_t callback={}) |
Moves the guild member to a other voice channel, if member is connected to one. More... | |
void | guild_set_nickname (snowflake guild_id, const std::string &nickname, command_completion_event_t callback={}) |
Change current user nickname. More... | |
void | guild_member_add_role (snowflake guild_id, snowflake user_id, snowflake role_id, command_completion_event_t callback={}) |
Add role to guild member. More... | |
void | guild_member_delete_role (snowflake guild_id, snowflake user_id, snowflake role_id, command_completion_event_t callback={}) |
Remove role from guild member. More... | |
void | guild_member_delete (snowflake guild_id, snowflake user_id, command_completion_event_t callback={}) |
Remove (kick) a guild member. More... | |
void | guild_ban_add (snowflake guild_id, snowflake user_id, uint32_t delete_message_days, const std::string &reason, command_completion_event_t callback={}) |
Add guild ban. More... | |
void | guild_ban_delete (snowflake guild_id, snowflake user_id, command_completion_event_t callback={}) |
Delete guild ban. More... | |
void | guild_get_bans (snowflake guild_id, command_completion_event_t callback) |
Get guild ban list. More... | |
void | guild_get_ban (snowflake guild_id, snowflake user_id, command_completion_event_t callback) |
Get single guild ban. More... | |
void | template_get (const std::string &code, command_completion_event_t callback) |
Get a template. More... | |
void | guild_create_from_template (const std::string &code, const std::string &name, command_completion_event_t callback={}) |
Create a new guild based on a template. More... | |
void | guild_templates_get (snowflake guild_id, command_completion_event_t callback) |
Get guild templates. More... | |
void | guild_template_create (snowflake guild_id, const std::string &name, const std::string &description, command_completion_event_t callback) |
Creates a template for the guild. More... | |
void | guild_template_sync (snowflake guild_id, const std::string &code, command_completion_event_t callback={}) |
Syncs the template to the guild's current state. More... | |
void | guild_template_modify (snowflake guild_id, const std::string &code, const std::string &name, const std::string &description, command_completion_event_t callback={}) |
Modifies the template's metadata. More... | |
void | guild_template_delete (snowflake guild_id, const std::string &code, command_completion_event_t callback={}) |
Deletes the template. More... | |
void | guild_create (const class guild &g, command_completion_event_t callback={}) |
Create a guild. More... | |
void | guild_edit (const class guild &g, command_completion_event_t callback={}) |
Edit a guild. More... | |
void | guild_delete (snowflake guild_id, command_completion_event_t callback={}) |
Delete a guild. More... | |
void | guild_emojis_get (snowflake guild_id, command_completion_event_t callback) |
Get all emojis for a guild. More... | |
void | guild_emoji_get (snowflake guild_id, snowflake emoji_id, command_completion_event_t callback) |
Get a single emoji. More... | |
void | guild_emoji_create (snowflake guild_id, const class emoji &newemoji, command_completion_event_t callback={}) |
Create single emoji. You must ensure that the emoji passed contained image data using the emoji::load_image() method. More... | |
void | guild_emoji_edit (snowflake guild_id, const class emoji &newemoji, command_completion_event_t callback={}) |
Edit a single emoji. You must ensure that the emoji passed contained image data using the emoji::load_image() method. More... | |
void | guild_emoji_delete (snowflake guild_id, snowflake emoji_id, command_completion_event_t callback={}) |
Delete a guild emoji. More... | |
void | guild_get_prune_counts (snowflake guild_id, const struct prune &pruneinfo, command_completion_event_t callback) |
Get prune counts. More... | |
void | guild_begin_prune (snowflake guild_id, const struct prune &pruneinfo, command_completion_event_t callback={}) |
Begin guild prune. More... | |
void | guild_get_voice_regions (snowflake guild_id, command_completion_event_t callback) |
Get guild voice regions. Voice regions per guild are somewhat deprecated in preference of per-channel voice regions. More... | |
void | get_guild_invites (snowflake guild_id, command_completion_event_t callback) |
Get guild invites. More... | |
void | guild_get_integrations (snowflake guild_id, command_completion_event_t callback) |
Get guild itegrations. More... | |
void | guild_modify_integration (snowflake guild_id, const class integration &i, command_completion_event_t callback={}) |
Modify guild integration. More... | |
void | guild_delete_integration (snowflake guild_id, snowflake integration_id, command_completion_event_t callback={}) |
Delete guild integration. More... | |
void | guild_sync_integration (snowflake guild_id, snowflake integration_id, command_completion_event_t callback={}) |
Sync guild integration. More... | |
void | guild_get_widget (snowflake guild_id, command_completion_event_t callback) |
Get guild widget. More... | |
void | guild_edit_widget (snowflake guild_id, const class guild_widget &gw, command_completion_event_t callback={}) |
Edit guild widget. More... | |
void | guild_get_vanity (snowflake guild_id, command_completion_event_t callback) |
Get guild vanity url, if enabled. More... | |
void | create_webhook (const class webhook &w, command_completion_event_t callback={}) |
Create a webhook. More... | |
void | get_guild_webhooks (snowflake guild_id, command_completion_event_t callback) |
Get guild webhooks. More... | |
void | get_channel_webhooks (snowflake channel_id, command_completion_event_t callback) |
Get channel webhooks. More... | |
void | get_webhook (snowflake webhook_id, command_completion_event_t callback) |
Get webhook. More... | |
void | get_webhook_with_token (snowflake webhook_id, const std::string &token, command_completion_event_t callback) |
Get webhook using token. More... | |
void | edit_webhook (const class webhook &wh, command_completion_event_t callback={}) |
Edit webhook. More... | |
void | edit_webhook_with_token (const class webhook &wh, command_completion_event_t callback={}) |
Edit webhook with token (token is encapsulated in the webhook object) More... | |
void | delete_webhook (snowflake webhook_id, command_completion_event_t callback={}) |
Delete a webhook. More... | |
void | delete_webhook_with_token (snowflake webhook_id, const std::string &token, command_completion_event_t callback={}) |
Delete webhook with token. More... | |
void | execute_webhook (const class webhook &wh, const struct message &m, bool wait=false, snowflake thread_id=0, command_completion_event_t callback={}) |
Execute webhook. More... | |
void | get_webhook_message (const class webhook &wh, command_completion_event_t callback={}) |
Get webhook message. More... | |
void | edit_webhook_message (const class webhook &wh, const struct message &m, command_completion_event_t callback={}) |
Edit webhook message. More... | |
void | delete_webhook_message (const class webhook &wh, snowflake message_id, command_completion_event_t callback={}) |
Delete webhook message. More... | |
void | roles_get (snowflake guild_id, command_completion_event_t callback) |
Get a role for a guild. More... | |
void | role_create (const class role &r, command_completion_event_t callback={}) |
Create a role on a guild. More... | |
void | role_edit (const class role &r, command_completion_event_t callback={}) |
Edit a role on a guild. More... | |
void | role_edit_position (const class role &r, command_completion_event_t callback={}) |
Edit a role's position in a guild. More... | |
void | role_delete (snowflake guild_id, snowflake role_id, command_completion_event_t callback={}) |
Delete a role. More... | |
void | user_get (snowflake user_id, command_completion_event_t callback) |
Get a user by id. More... | |
void | current_user_get (command_completion_event_t callback) |
Get current (bot) user. More... | |
void | current_user_get_guilds (command_completion_event_t callback) |
Get current (bot) user guilds. More... | |
void | current_user_edit (const std::string &nickname, const std::string &image_blob="", const image_type type=i_png, command_completion_event_t callback={}) |
Edit current (bot) user. More... | |
void | current_user_get_dms (command_completion_event_t callback) |
Get current user DM channels. More... | |
void | create_dm_channel (snowflake user_id, command_completion_event_t callback={}) |
Create a dm channel. More... | |
void | current_user_leave_guild (snowflake guild_id, command_completion_event_t callback={}) |
Leave a guild. More... | |
void | thread_create (const std::string &thread_name, snowflake channel_id, uint16_t auto_archive_duration, channel_type thread_type, command_completion_event_t callback={}) |
Create a thread. More... | |
void | thread_create_with_message (const std::string &thread_name, snowflake channel_id, snowflake message_id, uint16_t auto_archive_duration, command_completion_event_t callback={}) |
Create a thread with a message (Discord: ID of a thread is same as message ID) More... | |
void | current_user_join_thread (snowflake thread_id, command_completion_event_t callback={}) |
Join a thread. More... | |
void | current_user_leave_thread (snowflake thread_id, command_completion_event_t callback={}) |
Leave a thread. More... | |
void | thread_member_add (snowflake thread_id, snowflake user_id, command_completion_event_t callback={}) |
Add a member to a thread. More... | |
void | thread_member_remove (snowflake thread_id, snowflake user_id, command_completion_event_t callback={}) |
Remove a member from a thread. More... | |
void | get_thread_members (snowflake thread_id, command_completion_event_t callback={}) |
Get members of a thread. More... | |
void | get_active_threads (snowflake channel_id, command_completion_event_t callback={}) |
Get active threads in a channel (Sorted by ID in descending order) More... | |
void | get_public_archived_threads (snowflake channel_id, time_t before_timestamp=0, uint16_t limit=0, command_completion_event_t callback={}) |
Get public archived threads in a channel (Sorted by archive_timestamp in descending order) More... | |
void | get_private_archived_threads (snowflake channel_id, time_t before_timestamp=0, uint16_t limit=0, command_completion_event_t callback={}) |
Get private archived threads in a channel (Sorted by archive_timestamp in descending order) More... | |
void | get_joined_private_archived_threads (snowflake channel_id, snowflake before_id=0, uint16_t limit=0, command_completion_event_t callback={}) |
Get private archived threads in a channel which current user has joined (Sorted by ID in descending order) More... | |
void | guild_sticker_create (sticker &s, command_completion_event_t callback={}) |
Create a sticker in a guild. More... | |
void | guild_sticker_modify (sticker &s, command_completion_event_t callback={}) |
Modify a sticker in a guild. More... | |
void | guild_sticker_delete (snowflake sticker_id, snowflake guild_id, command_completion_event_t callback={}) |
Delete a sticker from a guild. More... | |
void | nitro_sticker_get (snowflake id, command_completion_event_t callback) |
Get a nitro sticker. More... | |
void | guild_sticker_get (snowflake id, snowflake guild_id, command_completion_event_t callback) |
Get a guild sticker. More... | |
void | guild_stickers_get (snowflake guild_id, command_completion_event_t callback) |
Get all guild stickers. More... | |
void | sticker_packs_get (command_completion_event_t callback) |
Get sticker packs. More... | |
void | get_voice_regions (command_completion_event_t callback) |
Get all voice regions. More... | |
void | get_gateway_bot (command_completion_event_t callback) |
Get the gateway information for the bot using the token. More... | |
Public Attributes | |
std::string | token |
time_t | last_identify |
uint32_t | intents |
uint32_t | numshards |
uint32_t | cluster_id |
uint32_t | maxclusters |
double | rest_ping |
dpp::dispatcher | dispatch |
dpp::user | me |
The details of the bot user. This is assumed to be identical across all shards in the cluster. Each connecting shard updates this information. More... | |
cache_policy_t | cache_policy |
The cluster class represents a group of shards and a command queue for sending and receiving commands from discord via HTTP. You should usually instantiate a cluster object at the very least to make use of the library.
dpp::cluster::cluster | ( | const std::string & | token, |
uint32_t | intents = i_default_intents , |
||
uint32_t | shards = 0 , |
||
uint32_t | cluster_id = 0 , |
||
uint32_t | maxclusters = 1 , |
||
bool | compressed = true , |
||
cache_policy_t | policy = {cp_aggressive, cp_aggressive, cp_aggressive} |
||
) |
Constructor for creating a cluster. All but the token are optional.
token | The bot token to use for all HTTP commands and websocket connections |
intents | A bitmask of dpd::intents values for all shards on this cluster. This is required to be sent for all bots with over 100 servers. |
shards | The total number of shards on this bot. If there are multiple clusters, then (shards / clusters) actual shards will run on this cluster. If you omit this value, the library will attempt to query the Discord API for the correct number of shards to start. |
cluster_id | The ID of this cluster, should be between 0 and MAXCLUSTERS-1 |
maxclusters | The total number of clusters that are active, which may be on separate processes or even separate machines. |
compressed | Whether or not to use compression for shards on this cluster. Saves a ton of bandwidth at the cost of some CPU |
policy | Set the user caching policy for the cluster, either lazy (only cache users/members when they message the bot) or aggressive (request whole member lists on seeing new guilds too) |
|
delete |
dpp::cluster is non-copyable
|
delete |
dpp::cluster is non-moveable
dpp::cluster::~cluster | ( | ) |
Destructor
void dpp::cluster::channel_create | ( | const class channel & | c, |
command_completion_event_t | callback = {} |
||
) |
Create a channel.
c | Channel to create |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_delete | ( | snowflake | channel_id, |
command_completion_event_t | callback = {} |
||
) |
Delete a channel.
channel_id | Channel id to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_delete_permission | ( | const class channel & | c, |
snowflake | overwrite_id, | ||
command_completion_event_t | callback = {} |
||
) |
Remove a permission from a channel.
c | Channel to remove permission from |
overwrite_id | Overwrite to remove, user or channel ID |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_edit | ( | const class channel & | c, |
command_completion_event_t | callback = {} |
||
) |
Edit a channel.
c | Channel to edit/update |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_edit_permissions | ( | const class channel & | c, |
snowflake | overwrite_id, | ||
uint32_t | allow, | ||
uint32_t | deny, | ||
bool | member, | ||
command_completion_event_t | callback = {} |
||
) |
Edit a channel's permissions.
c | Channel to set permissions for |
overwrite_id | Overwrite to change (a user or channel ID) |
allow | allow permissions |
deny | deny permissions |
member | true if the overwrite_id is a user id, false if it is a channel id |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_edit_position | ( | const class channel & | c, |
command_completion_event_t | callback = {} |
||
) |
Edit a channel's position.
c | Channel to change the position for |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_follow_news | ( | const class channel & | c, |
snowflake | target_channel_id, | ||
command_completion_event_t | callback = {} |
||
) |
Follow a news channel.
c | Channel id to follow |
target_channel_id | Channel to subscribe the channel to |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_get | ( | snowflake | c, |
command_completion_event_t | callback | ||
) |
Get a channel.
c | Channel ID to retrieve |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_invite_create | ( | const class channel & | c, |
const class invite & | i, | ||
command_completion_event_t | callback = {} |
||
) |
Create invite for a channel.
c | Channel to create an invite on |
i | Invite to create |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_invites_get | ( | const class channel & | c, |
command_completion_event_t | callback | ||
) |
Get invites for a channel.
c | Channel to get invites for |
callback | Function to call when the API call completes. |
void dpp::cluster::channel_typing | ( | const class channel & | c, |
command_completion_event_t | callback = {} |
||
) |
Trigger channel typing indicator.
c | Channel to set as typing on |
callback | Function to call when the API call completes. |
void dpp::cluster::channels_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get all channels for a guild.
guild_id | Guild ID to retrieve channels for |
callback | Function to call when the API call completes. |
void dpp::cluster::create_dm_channel | ( | snowflake | user_id, |
command_completion_event_t | callback = {} |
||
) |
Create a dm channel.
user_id | User ID to create DM channel with |
callback | Function to call when the API call completes. |
void dpp::cluster::create_webhook | ( | const class webhook & | w, |
command_completion_event_t | callback = {} |
||
) |
Create a webhook.
w | Webhook to create |
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_edit | ( | const std::string & | nickname, |
const std::string & | image_blob = "" , |
||
const image_type | type = i_png , |
||
command_completion_event_t | callback = {} |
||
) |
Edit current (bot) user.
nickname | Nickname to set |
image_blob | Avatar data to upload (NOTE: Very heavily rate limited!) |
type | Type of image for avatar |
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_get | ( | command_completion_event_t | callback | ) |
Get current (bot) user.
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_get_dms | ( | command_completion_event_t | callback | ) |
Get current user DM channels.
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_get_guilds | ( | command_completion_event_t | callback | ) |
Get current (bot) user guilds.
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_join_thread | ( | snowflake | thread_id, |
command_completion_event_t | callback = {} |
||
) |
Join a thread.
thread_id | Thread ID to join |
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_leave_guild | ( | snowflake | guild_id, |
command_completion_event_t | callback = {} |
||
) |
Leave a guild.
guild_id | Guild ID to leave |
callback | Function to call when the API call completes. |
void dpp::cluster::current_user_leave_thread | ( | snowflake | thread_id, |
command_completion_event_t | callback = {} |
||
) |
Leave a thread.
thread_id | Thread ID to leave |
callback | Function to call when the API call completes. |
void dpp::cluster::delete_webhook | ( | snowflake | webhook_id, |
command_completion_event_t | callback = {} |
||
) |
Delete a webhook.
webhook_id | Webhook ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::delete_webhook_message | ( | const class webhook & | wh, |
snowflake | message_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete webhook message.
wh | Webhook to delete message for |
message_id | Message ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::delete_webhook_with_token | ( | snowflake | webhook_id, |
const std::string & | token, | ||
command_completion_event_t | callback = {} |
||
) |
Delete webhook with token.
webhook_id | Webhook ID to delete |
token | Token of webhook to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::direct_message_create | ( | snowflake | user_id, |
const message & | m, | ||
command_completion_event_t | callback = {} |
||
) |
Create a direct message, also create the channel for the direct message if needed.
user_id | User ID of user to send message to |
m | Message object |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::edit_webhook | ( | const class webhook & | wh, |
command_completion_event_t | callback = {} |
||
) |
Edit webhook.
wh | Webhook to edit |
callback | Function to call when the API call completes. |
void dpp::cluster::edit_webhook_message | ( | const class webhook & | wh, |
const struct message & | m, | ||
command_completion_event_t | callback = {} |
||
) |
Edit webhook message.
wh | Webhook to edit message for |
m | New message |
callback | Function to call when the API call completes. |
void dpp::cluster::edit_webhook_with_token | ( | const class webhook & | wh, |
command_completion_event_t | callback = {} |
||
) |
Edit webhook with token (token is encapsulated in the webhook object)
wh | Wehook to edit (should include token) |
callback | Function to call when the API call completes. |
void dpp::cluster::execute_webhook | ( | const class webhook & | wh, |
const struct message & | m, | ||
bool | wait = false , |
||
snowflake | thread_id = 0 , |
||
command_completion_event_t | callback = {} |
||
) |
Execute webhook.
wh | Webhook to execute |
m | Message to send |
wait | waits for server confirmation of message send before response, and returns the created message body |
thread_id | Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived |
callback | Function to call when the API call completes. |
void dpp::cluster::gdm_add | ( | snowflake | channel_id, |
snowflake | user_id, | ||
const std::string & | access_token, | ||
const std::string & | nick, | ||
command_completion_event_t | callback = {} |
||
) |
Adds a recipient to a Group DM using their access token.
channel_id | Channel id to add group DM recipients to |
user_id | User ID to add |
access_token | Access token from OAuth2 |
nick | Nickname of user to apply to the chat |
callback | Function to call when the API call completes. |
void dpp::cluster::gdm_remove | ( | snowflake | channel_id, |
snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Removes a recipient from a Group DM.
channel_id | Channel ID of group DM |
user_id | User ID to remove from group DM |
callback | Function to call when the API call completes. |
void dpp::cluster::get_active_threads | ( | snowflake | channel_id, |
command_completion_event_t | callback = {} |
||
) |
Get active threads in a channel (Sorted by ID in descending order)
channel_id | Channel to get active threads for |
callback | Function to call when the API call completes |
void dpp::cluster::get_channel_webhooks | ( | snowflake | channel_id, |
command_completion_event_t | callback | ||
) |
Get channel webhooks.
channel_id | Channel ID to get webhooks for |
callback | Function to call when the API call completes. |
Get the dm channel for a user id.
user_id | the user id to get the dm channel for |
void dpp::cluster::get_gateway_bot | ( | command_completion_event_t | callback | ) |
Get the gateway information for the bot using the token.
callback | Function to call when the API call completes. |
void dpp::cluster::get_guild_invites | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild invites.
guild_id | Guild ID to get invites for |
callback | Function to call when the API call completes. |
void dpp::cluster::get_guild_webhooks | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild webhooks.
guild_id | Guild ID to get webhooks for |
callback | Function to call when the API call completes. |
void dpp::cluster::get_joined_private_archived_threads | ( | snowflake | channel_id, |
snowflake | before_id = 0 , |
||
uint16_t | limit = 0 , |
||
command_completion_event_t | callback = {} |
||
) |
Get private archived threads in a channel which current user has joined (Sorted by ID in descending order)
channel_id | Channel to get public archived threads for |
before_id | Get threads before this id |
limit | Number of threads to get |
callback | Function to call when the API call completes |
void dpp::cluster::get_private_archived_threads | ( | snowflake | channel_id, |
time_t | before_timestamp = 0 , |
||
uint16_t | limit = 0 , |
||
command_completion_event_t | callback = {} |
||
) |
Get private archived threads in a channel (Sorted by archive_timestamp in descending order)
channel_id | Channel to get public archived threads for |
before_timestamp | Get threads before this timestamp |
limit | Number of threads to get |
callback | Function to call when the API call completes |
void dpp::cluster::get_public_archived_threads | ( | snowflake | channel_id, |
time_t | before_timestamp = 0 , |
||
uint16_t | limit = 0 , |
||
command_completion_event_t | callback = {} |
||
) |
Get public archived threads in a channel (Sorted by archive_timestamp in descending order)
channel_id | Channel to get public archived threads for |
before_timestamp | Get threads before this timestamp |
limit | Number of threads to get |
callback | Function to call when the API call completes |
discord_client * dpp::cluster::get_shard | ( | uint32_t | id | ) |
Get a shard by id, returning the discord_client.
id | Shard ID |
const shard_list & dpp::cluster::get_shards | ( | ) |
Get the list of shards.
void dpp::cluster::get_thread_members | ( | snowflake | thread_id, |
command_completion_event_t | callback = {} |
||
) |
Get members of a thread.
thread_id | Thread to get members for |
callback | Function to call when the API call completes |
void dpp::cluster::get_voice_regions | ( | command_completion_event_t | callback | ) |
Get all voice regions.
callback | Function to call when the API call completes. |
void dpp::cluster::get_webhook | ( | snowflake | webhook_id, |
command_completion_event_t | callback | ||
) |
Get webhook.
webhook_id | Webhook ID to get |
callback | Function to call when the API call completes. |
void dpp::cluster::get_webhook_message | ( | const class webhook & | wh, |
command_completion_event_t | callback = {} |
||
) |
Get webhook message.
wh | Webhook to get the original message for |
callback | Function to call when the API call completes. |
void dpp::cluster::get_webhook_with_token | ( | snowflake | webhook_id, |
const std::string & | token, | ||
command_completion_event_t | callback | ||
) |
Get webhook using token.
webhook_id | Webhook ID to retrieve |
token | Token of webhook |
callback | Function to call when the API call completes. |
void dpp::cluster::global_bulk_command_create | ( | const std::vector< slashcommand > & | commands, |
command_completion_event_t | callback = {} |
||
) |
Create/overwrite global slash commands.
commands | Vector of slash commands to create/update. overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour. Commands that do not already exist will count toward daily application command create limits. |
callback | Function to call when the API call completes. On success the callback will contain a list of dpp::slashcommmand object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::global_command_create | ( | slashcommand & | s, |
command_completion_event_t | callback = {} |
||
) |
Create a global slash command (a bot can have a maximum of 100 of these)
s | Slash command to create, s.id will be filled if the creation succeeds |
callback | Function to call when the API call completes. On success the callback will contain a dpp::slashcommmand object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::global_command_delete | ( | snowflake | id, |
command_completion_event_t | callback = {} |
||
) |
Delete a global slash command (a bot can have a maximum of 100 of these)
id | Slash command to delete |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::global_command_edit | ( | const slashcommand & | s, |
command_completion_event_t | callback = {} |
||
) |
Edit a global slash command (a bot can have a maximum of 100 of these)
s | Slash command to change |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::global_commands_get | ( | command_completion_event_t | callback | ) |
Get the application's global slash commands.
callback | Function to call when the API call completes. On success the callback will contain a dpp::slashcommand_map object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_add_member | ( | const guild_member & | gm, |
const std::string & | access_token, | ||
command_completion_event_t | callback = {} |
||
) |
Add guild member. Needs a specific oauth2 scope, from which you get the access_token.
gm | Guild member to add |
access_token | Access token from Oauth2 scope |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_auditlog_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get the audit log for a guild.
guild_id | Guild to get the audit log of |
callback | Function to call when the API call completes. On success the callback will contain a dpp::auditlog object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_ban_add | ( | snowflake | guild_id, |
snowflake | user_id, | ||
uint32_t | delete_message_days, | ||
const std::string & | reason, | ||
command_completion_event_t | callback = {} |
||
) |
Add guild ban.
guild_id | Guild ID to add ban to |
user_id | User ID to ban |
delete_message_days | How many days of ther user's messages to also delete |
reason | Reason for ban |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_ban_delete | ( | snowflake | guild_id, |
snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete guild ban.
guild_id | Guild to delete ban from |
user_id | User ID to delete ban for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_begin_prune | ( | snowflake | guild_id, |
const struct prune & | pruneinfo, | ||
command_completion_event_t | callback = {} |
||
) |
Begin guild prune.
guild_id | Guild ID to prune |
pruneinfo | Pruning info |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_bulk_command_create | ( | const std::vector< slashcommand > & | commands, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Create/overwrite guild slash commands.
commands | Vector of slash commands to create/update. New guild commands will be available in the guild immediately. If the command did not already exist, it will count toward daily application command create limits. |
guild_id | Guild ID to create/update the slash commands in |
callback | Function to call when the API call completes. On success the callback will contain a list of dpp::slashcommmand object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_command_create | ( | slashcommand & | s, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Create a slash command local to a guild.
s | Slash command to create, s.id will be filled if the creation succeeds |
guild_id | Guild ID to create the slash command in |
callback | Function to call when the API call completes. On success the callback will contain a dpp::slashcommmand object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_command_delete | ( | snowflake | id, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a slash command local to a guild.
id | Slash command to delete |
guild_id | Guild ID to delete the slash command in |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_command_edit | ( | const slashcommand & | s, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Edit a slash command local to a guild.
s | Slash command to edit |
guild_id | Guild ID to edit the slash command in |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_command_edit_permissions | ( | const slashcommand & | s, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Edit slash command permissions local to a guild, permissions are read from s.permissions.
s | Slash command to edit |
guild_id | Guild ID to edit the slash command in |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_commands_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get the application's slash commands for a guild.
guild_id | Guild ID to get the slash commands for |
callback | Function to call when the API call completes. On success the callback will contain a dpp::slashcommand_map object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_create | ( | const class guild & | g, |
command_completion_event_t | callback = {} |
||
) |
Create a guild.
g | Guild to create |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_create_from_template | ( | const std::string & | code, |
const std::string & | name, | ||
command_completion_event_t | callback = {} |
||
) |
Create a new guild based on a template.
code | Template code to create guild from |
name | Guild name to create |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_delete | ( | snowflake | guild_id, |
command_completion_event_t | callback = {} |
||
) |
Delete a guild.
guild_id | Guild ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_delete_integration | ( | snowflake | guild_id, |
snowflake | integration_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete guild integration.
guild_id | Guild ID to delete integration for |
integration_id | Integration ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_edit | ( | const class guild & | g, |
command_completion_event_t | callback = {} |
||
) |
Edit a guild.
g | Guild to edit |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_edit_member | ( | const guild_member & | gm, |
command_completion_event_t | callback = {} |
||
) |
Edit the properties of an existing guild member.
gm | Guild member to edit |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_edit_widget | ( | snowflake | guild_id, |
const class guild_widget & | gw, | ||
command_completion_event_t | callback = {} |
||
) |
Edit guild widget.
guild_id | Guild ID to edit widget for |
gw | New guild widget information |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_emoji_create | ( | snowflake | guild_id, |
const class emoji & | newemoji, | ||
command_completion_event_t | callback = {} |
||
) |
Create single emoji. You must ensure that the emoji passed contained image data using the emoji::load_image() method.
guild_id | Guild ID to create emoji om |
newemoji | Emoji to create |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_emoji_delete | ( | snowflake | guild_id, |
snowflake | emoji_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a guild emoji.
guild_id | Guild ID to delete emoji on |
emoji_id | Emoji ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_emoji_edit | ( | snowflake | guild_id, |
const class emoji & | newemoji, | ||
command_completion_event_t | callback = {} |
||
) |
Edit a single emoji. You must ensure that the emoji passed contained image data using the emoji::load_image() method.
guild_id | Guild ID to edit emoji on |
newemoji | Emoji to edit |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_emoji_get | ( | snowflake | guild_id, |
snowflake | emoji_id, | ||
command_completion_event_t | callback | ||
) |
Get a single emoji.
guild_id | Guild ID to get emoji for |
emoji_id | Emoji ID to get |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_emojis_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get all emojis for a guild.
guild_id | Guild ID to get emojis for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get | ( | snowflake | g, |
command_completion_event_t | callback | ||
) |
Get a guild.
g | Guild ID to retrieve |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_ban | ( | snowflake | guild_id, |
snowflake | user_id, | ||
command_completion_event_t | callback | ||
) |
Get single guild ban.
guild_id | Guild ID to get ban for |
user_id | User ID of ban to retrieve |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_bans | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild ban list.
guild_id | Guild ID to get bans for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_integrations | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild itegrations.
guild_id | Guild ID to get integrations for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_member | ( | snowflake | guild_id, |
snowflake | user_id, | ||
command_completion_event_t | callback | ||
) |
Get a guild member.
guild_id | Guild ID to get member for |
user_id | User ID of member to get |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_members | ( | snowflake | guild_id, |
uint16_t | limit, | ||
snowflake | after, | ||
command_completion_event_t | callback | ||
) |
Get all guild members.
guild_id | Guild ID to get all members for |
limit | max number of members to return (1-1000) |
after | the highest user id in the previous page |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_preview | ( | snowflake | g, |
command_completion_event_t | callback | ||
) |
Get a guild preview. Returns a guild object but only a subset of the fields will be populated.
g | Guild ID to retrieve |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_prune_counts | ( | snowflake | guild_id, |
const struct prune & | pruneinfo, | ||
command_completion_event_t | callback | ||
) |
Get prune counts.
guild_id | Guild ID to count for pruning |
pruneinfo | Pruning info |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_vanity | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild vanity url, if enabled.
guild_id | Guild to get vanity URL for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_voice_regions | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild voice regions. Voice regions per guild are somewhat deprecated in preference of per-channel voice regions.
guild_id | Guild ID to get voice regions for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_get_widget | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild widget.
guild_id | Guild ID to get widget for |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_member_add_role | ( | snowflake | guild_id, |
snowflake | user_id, | ||
snowflake | role_id, | ||
command_completion_event_t | callback = {} |
||
) |
Add role to guild member.
guild_id | Guild ID to add a role to |
user_id | User ID to add role to |
role_id | Role ID to add to the user |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_member_delete | ( | snowflake | guild_id, |
snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Remove (kick) a guild member.
guild_id | Guild ID to kick member from |
user_id | User ID to kick |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_member_delete_role | ( | snowflake | guild_id, |
snowflake | user_id, | ||
snowflake | role_id, | ||
command_completion_event_t | callback = {} |
||
) |
Remove role from guild member.
guild_id | Guild ID to remove role from user on |
user_id | User ID to remove role from |
role_id | Role to remove |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_member_move | ( | const snowflake | channel_id, |
const snowflake | guild_id, | ||
const snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Moves the guild member to a other voice channel, if member is connected to one.
channel_id | Id of the channel to which the user is used |
guild_id | Guild id to which the user is connected |
user_id | User id, who should be moved |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_modify_integration | ( | snowflake | guild_id, |
const class integration & | i, | ||
command_completion_event_t | callback = {} |
||
) |
Modify guild integration.
guild_id | Guild ID to modify integration for |
i | Integration to modify |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_search_members | ( | snowflake | guild_id, |
const std::string & | query, | ||
uint16_t | limit, | ||
command_completion_event_t | callback | ||
) |
Search for guild members based on whether their username or nickname starts with the given string.
guild_id | Guild ID to search in |
query | Query string to match username(s) and nickname(s) against |
limit | max number of members to return (1-1000) |
void dpp::cluster::guild_set_nickname | ( | snowflake | guild_id, |
const std::string & | nickname, | ||
command_completion_event_t | callback = {} |
||
) |
Change current user nickname.
guild_id | Guild ID to change nickanem on |
nickname | New nickname, or empty string to clear nickname |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_sticker_create | ( | sticker & | s, |
command_completion_event_t | callback = {} |
||
) |
Create a sticker in a guild.
s | Sticker to create. Must have its guild ID set. |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_sticker_delete | ( | snowflake | sticker_id, |
snowflake | guild_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a sticker from a guild.
sticker_id | sticker ID to delete |
guild_id | guild ID to delete from |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_sticker_get | ( | snowflake | id, |
snowflake | guild_id, | ||
command_completion_event_t | callback | ||
) |
Get a guild sticker.
id | Id of sticker to get. |
guild_id | Guild ID of the guild where the sticker is |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_sticker_modify | ( | sticker & | s, |
command_completion_event_t | callback = {} |
||
) |
Modify a sticker in a guild.
s | Sticker to modify. Must have its guild ID and sticker ID set. |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_stickers_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get all guild stickers.
guild_id | Guild ID of the guild where the sticker is |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::guild_sync_integration | ( | snowflake | guild_id, |
snowflake | integration_id, | ||
command_completion_event_t | callback = {} |
||
) |
Sync guild integration.
guild_id | Guild ID to sync integration on |
integration_id | Integration ID to synchronise |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_template_create | ( | snowflake | guild_id, |
const std::string & | name, | ||
const std::string & | description, | ||
command_completion_event_t | callback | ||
) |
Creates a template for the guild.
guild_id | Guild to create template from |
name | Template name to create |
description | Description of template to create |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_template_delete | ( | snowflake | guild_id, |
const std::string & | code, | ||
command_completion_event_t | callback = {} |
||
) |
Deletes the template.
guild_id | Guild ID of template to delete |
code | Template code to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_template_modify | ( | snowflake | guild_id, |
const std::string & | code, | ||
const std::string & | name, | ||
const std::string & | description, | ||
command_completion_event_t | callback = {} |
||
) |
Modifies the template's metadata.
guild_id | Guild ID of template to modify |
code | Template code to modify |
name | New name of template |
description | New description of template |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_template_sync | ( | snowflake | guild_id, |
const std::string & | code, | ||
command_completion_event_t | callback = {} |
||
) |
Syncs the template to the guild's current state.
guild_id | Guild to synchronise template for |
code | Code of template to synchronise |
callback | Function to call when the API call completes. |
void dpp::cluster::guild_templates_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get guild templates.
guild_id | Guild ID to get templates for |
callback | Function to call when the API call completes. |
void dpp::cluster::interaction_response_create | ( | snowflake | interaction_id, |
const std::string & | token, | ||
const interaction_response & | r, | ||
command_completion_event_t | callback = {} |
||
) |
Respond to a slash command.
interaction_id | Interaction id to respond to |
token | Token for the interaction webhook |
r | Response to send |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::interaction_response_edit | ( | const std::string & | token, |
const message & | r, | ||
command_completion_event_t | callback = {} |
||
) |
Respond to a slash command.
token | Token for the interaction webhook |
r | Message to send |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::invite_delete | ( | const std::string & | invite, |
command_completion_event_t | callback = {} |
||
) |
Delete an invite.
invite | Invite code to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::invite_get | ( | const std::string & | invite, |
command_completion_event_t | callback | ||
) |
Get details about an invite.
invite | Invite code to get information on |
callback | Function to call when the API call completes. |
void dpp::cluster::log | ( | dpp::loglevel | severity, |
const std::string & | msg | ||
) | const |
Log a message to whatever log the user is using. The logged message is passed up the chain to the on_log event in user code which can then do whatever it wants to do with it.
severity | The log level from dpp::loglevel |
msg | The log message to output |
void dpp::cluster::message_add_reaction | ( | const struct message & | m, |
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Add a reaction to a message. The reaction string must be either an emojiname:id
or a unicode character.
m | Message to add a reaction to |
reaction | Reaction to add. Emojis should be in the form emojiname:id |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_add_reaction | ( | snowflake | message_id, |
snowflake | channel_id, | ||
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Add a reaction to a message by id. The reaction string must be either an emojiname:id
or a unicode character.
message_id | Message to add reactions to |
channel_id | Channel to add reactions to |
reaction | Reaction to add. Emojis should be in the form emojiname:id |
callback | Function to call when the API call completes. On success the callback will contain a dpp::confirmation object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_create | ( | const struct message & | m, |
command_completion_event_t | callback = {} |
||
) |
Send a message to a channel. The callback function is called when the message has been sent.
m | Message to send |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_crosspost | ( | snowflake | message_id, |
snowflake | channel_id, | ||
command_completion_event_t | callback = {} |
||
) |
Crosspost a message. The callback function is called when the message has been sent.
message_id | Message to crosspost |
channel_id | Channel ID to crosspost from |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_delete | ( | snowflake | message_id, |
snowflake | channel_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a message from a channel. The callback function is called when the message has been edited.
message_id | Message ID to delete |
channel_id | Channel to delete from |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_all_reactions | ( | const struct message & | m, |
command_completion_event_t | callback = {} |
||
) |
Delete all reactions on a message.
m | Message to delete reactions from |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_all_reactions | ( | snowflake | message_id, |
snowflake | channel_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete all reactions on a message by id.
message_id | Message to delete reactions from |
channel_id | Channel to delete reactions from |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_bulk | ( | const std::vector< snowflake > & | message_ids, |
snowflake | channel_id, | ||
command_completion_event_t | callback = {} |
||
) |
Bulk delete messages from a channel. The callback function is called when the message has been edited.
message_ids | List of message IDs to delete (maximum of 100 message IDs) |
channel_id | Channel to delete from |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_own_reaction | ( | const struct message & | m, |
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete own reaction from a message. The reaction string must be either an emojiname:id
or a unicode character.
m | Message to delete own reaction from |
reaction | Reaction to delete. The reaction should be in the form emojiname:id |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_own_reaction | ( | snowflake | message_id, |
snowflake | channel_id, | ||
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete own reaction from a message by id. The reaction string must be either an emojiname:id
or a unicode character.
message_id | Message to delete reactions from |
channel_id | Channel to delete reactions from |
reaction | Reaction to delete. The reaction should be in the form emojiname:id |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_reaction | ( | const struct message & | m, |
snowflake | user_id, | ||
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a user's reaction from a message. The reaction string must be either an emojiname:id
or a unicode character.
m | Message to delete a user's reaction from |
user_id | User ID who's reaction you want to remove |
reaction | Reaction to remove. Reactions should be in the form emojiname:id |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_reaction | ( | snowflake | message_id, |
snowflake | channel_id, | ||
snowflake | user_id, | ||
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a user's reaction from a message by id. The reaction string must be either an emojiname:id
or a unicode character.
message_id | Message to delete reactions from |
channel_id | Channel to delete reactions from |
user_id | User ID who's reaction you want to remove |
reaction | Reaction to remove. Reactions should be in the form emojiname:id |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_reaction_emoji | ( | const struct message & | m, |
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete all reactions on a message using a particular emoji. The reaction string must be either an emojiname:id
or a unicode character.
m | Message to delete reactions from |
reaction | Reaction to delete, in the form emojiname:id or a unicode character |
callback | Function to call when the API call completes. |
void dpp::cluster::message_delete_reaction_emoji | ( | snowflake | message_id, |
snowflake | channel_id, | ||
const std::string & | reaction, | ||
command_completion_event_t | callback = {} |
||
) |
Delete all reactions on a message using a particular emoji by id. The reaction string must be either an emojiname:id
or a unicode character.
message_id | Message to delete reactions from |
channel_id | Channel to delete reactions from |
reaction | Reaction to delete, in the form emojiname:id or a unicode character |
callback | Function to call when the API call completes. |
void dpp::cluster::message_edit | ( | const struct message & | m, |
command_completion_event_t | callback = {} |
||
) |
Edit a message on a channel. The callback function is called when the message has been edited.
m | Message to edit |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_get | ( | snowflake | message_id, |
snowflake | channel_id, | ||
command_completion_event_t | callback | ||
) |
Get a message.
message_id | Message ID |
channel_id | Channel ID |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::message_get_reactions | ( | const struct message & | m, |
const std::string & | reaction, | ||
snowflake | before, | ||
snowflake | after, | ||
snowflake | limit, | ||
command_completion_event_t | callback | ||
) |
Get reactions on a message for a particular emoji. The reaction string must be either an emojiname:id
or a unicode character.
m | Message to get reactions for |
reaction | Reaction should be in the form emojiname:id or a unicode character |
before | Reactions before this ID should be retrieved if this is set to non-zero |
after | Reactions before this ID should be retrieved if this is set to non-zero |
limit | This number of reactions maximum should be returned |
callback | Function to call when the API call completes. |
void dpp::cluster::message_get_reactions | ( | snowflake | message_id, |
snowflake | channel_id, | ||
const std::string & | reaction, | ||
snowflake | before, | ||
snowflake | after, | ||
snowflake | limit, | ||
command_completion_event_t | callback | ||
) |
Get reactions on a message for a particular emoji by id. The reaction string must be either an emojiname:id
or a unicode character.
message_id | Message to get reactions for |
channel_id | Channel to get reactions for |
reaction | Reaction should be in the form emojiname:id or a unicode character |
before | Reactions before this ID should be retrieved if this is set to non-zero |
after | Reactions before this ID should be retrieved if this is set to non-zero |
limit | This number of reactions maximum should be returned |
callback | Function to call when the API call completes. |
void dpp::cluster::message_pin | ( | snowflake | channel_id, |
snowflake | message_id, | ||
command_completion_event_t | callback = {} |
||
) |
Pin a message.
channel_id | Channel id to pin message on |
message_id | Message id to pin message on |
callback | Function to call when the API call completes. |
void dpp::cluster::message_unpin | ( | snowflake | channel_id, |
snowflake | message_id, | ||
command_completion_event_t | callback = {} |
||
) |
Unpin a message.
channel_id | Channel id to unpin message on |
message_id | Message id to unpin message on |
callback | Function to call when the API call completes. |
void dpp::cluster::messages_get | ( | snowflake | channel_id, |
snowflake | around, | ||
snowflake | before, | ||
snowflake | after, | ||
snowflake | limit, | ||
command_completion_event_t | callback | ||
) |
Get multiple messages.
channel_id | Channel ID to retrieve messages for |
around | Messages should be retrieved around this ID if this is set to non-zero |
before | Messages before this ID should be retrieved if this is set to non-zero |
after | Messages before this ID should be retrieved if this is set to non-zero |
limit | This number of messages maximum should be returned |
callback | Function to call when the API call completes. On success the callback will contain a dpp::message_map object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::nitro_sticker_get | ( | snowflake | id, |
command_completion_event_t | callback | ||
) |
Get a nitro sticker.
id | Id of sticker to get. |
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::on_application_command_create | ( | std::function< void(const application_command_create_t &_event)> | _application_command_create | ) |
Called when a new application command (slash command) is registered.
_application_command_create | User function to attach to event |
void dpp::cluster::on_application_command_delete | ( | std::function< void(const application_command_delete_t &_event)> | _application_command_delete | ) |
Called when an application command (slash command) is deleted.
_application_command_delete | User function to attach to event |
void dpp::cluster::on_application_command_update | ( | std::function< void(const application_command_update_t &_event)> | _application_command_update | ) |
Called when an application command (slash command) is updated. You will only receive this event for application commands that belong to your bot/application.
_application_command_update | User function to attach to event |
void dpp::cluster::on_button_click | ( | std::function< void(const button_click_t &_event)> | _button_click | ) |
Called when a button is clicked attached to a message. Button clicks are triggered by discord when buttons are clicked which you have associated with a message using dpp::component.
_button_click | User function to attach to event |
void dpp::cluster::on_channel_create | ( | std::function< void(const channel_create_t &_event)> | _channel_create | ) |
Called when a new channel is created on a guild.
_channel_create | User function to attach to event |
void dpp::cluster::on_channel_delete | ( | std::function< void(const channel_delete_t &_event)> | _channel_delete | ) |
Called when a channel is deleted from a guild. The channel will still be temporarily avaialble in the cache. Pointers to the channel should not be retained long-term as they will be deleted by the garbage collector.
_channel_delete | User function to attach to event |
void dpp::cluster::on_channel_pins_update | ( | std::function< void(const channel_pins_update_t &_event)> | _channel_pins_update | ) |
Called when a message is pinned. Note that the pinned message is not returned to this event, just the timestamp of the last pinned message.
_channel_pins_update | User function to attach to event |
void dpp::cluster::on_channel_update | ( | std::function< void(const channel_update_t &_event)> | _channel_update | ) |
Called when a channel is edited on a guild. The new channel details have already been applied to the guild when you receive this event.
_channel_update | User function to attach to event |
void dpp::cluster::on_guild_ban_add | ( | std::function< void(const guild_ban_add_t &_event)> | _guild_ban_add | ) |
Called when a ban is added to a guild.
_guild_ban_add | User function to attach to event |
void dpp::cluster::on_guild_ban_remove | ( | std::function< void(const guild_ban_remove_t &_event)> | _guild_ban_remove | ) |
Called when a ban is removed from a guild.
_guild_ban_remove | User function to attach to event |
void dpp::cluster::on_guild_create | ( | std::function< void(const guild_create_t &_event)> | _guild_create | ) |
Called when a new guild is created. D++ will request members for the guild for its cache using guild_members_chunk.
_guild_create | User function to attach to event |
void dpp::cluster::on_guild_delete | ( | std::function< void(const guild_delete_t &_event)> | _guild_delete | ) |
Called when a guild is deleted. A guild can be deleted via the bot being kicked, the bot leaving the guild explicitly with dpp::guild_delete, or via the guild being unavaialble due to an outage.
_guild_delete | User function to attach to event |
void dpp::cluster::on_guild_emojis_update | ( | std::function< void(const guild_emojis_update_t &_event)> | _guild_emojis_update | ) |
Called when new emojis are added to a guild. The complete set of emojis is sent every time.
_guild_emojis_update | User function to attach to event |
void dpp::cluster::on_guild_integrations_update | ( | std::function< void(const guild_integrations_update_t &_event)> | _guild_integrations_update | ) |
Called when an integration is updated for a guild. This returns the complete list. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc.
_guild_integrations_update | User function to attach to event |
void dpp::cluster::on_guild_join_request_delete | ( | std::function< void(const guild_join_request_delete_t &_event)> | _guild_join_request_delete | ) |
on guild join request delete. Triggered when a user declines the membership screening questionnaire for a guild.
_guild_join_request_delete | User function to attach to event |
void dpp::cluster::on_guild_member_add | ( | std::function< void(const guild_member_add_t &_event)> | _guild_member_add | ) |
Called when a new member joins a guild.
_guild_member_add | User function to attach to event |
void dpp::cluster::on_guild_member_remove | ( | std::function< void(const guild_member_remove_t &_event)> | _guild_member_remove | ) |
Called when a user leaves a guild (either through being kicked, or choosing to leave)
_guild_member_remove | User function to attach to event |
void dpp::cluster::on_guild_member_update | ( | std::function< void(const guild_member_update_t &_event)> | _guild_member_update | ) |
Called when details of a guild member (e.g. their roles or nickname) are updated.
_guild_member_update | User function to attach to event |
void dpp::cluster::on_guild_members_chunk | ( | std::function< void(const guild_members_chunk_t &_event)> | _guild_members_chunk | ) |
Called when a set of members is received for a guild. D++ will request these for all new guilds if needed, after the on_guild_create events.
_guild_members_chunk | User function to attach to event |
void dpp::cluster::on_guild_role_create | ( | std::function< void(const guild_role_create_t &_event)> | _guild_role_create | ) |
Called when a new role is created on a guild.
_guild_role_create | User function to attach to event |
void dpp::cluster::on_guild_role_delete | ( | std::function< void(const guild_role_delete_t &_event)> | _guild_role_delete | ) |
Called when a role is deleted in a guild.
_guild_role_delete | User function to attach to event |
void dpp::cluster::on_guild_role_update | ( | std::function< void(const guild_role_update_t &_event)> | _guild_role_update | ) |
Called when an existing role is updated on a guild.
_guild_role_update | User function to attach to event |
void dpp::cluster::on_guild_stickers_update | ( | std::function< void(const guild_stickers_update_t &_event)> | _guild_stickers_update | ) |
Called when new stickers are added to a guild. The complete set of stickers is sent every time.
_guild_stickers_update | User function to attach to event |
void dpp::cluster::on_guild_update | ( | std::function< void(const guild_update_t &_event)> | _guild_update | ) |
Called when details of a guild are updated.
_guild_update | User function to attach to event |
void dpp::cluster::on_integration_create | ( | std::function< void(const integration_create_t &_event)> | _integration_create | ) |
Called when a new intgration is attached to a guild by a user. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc.
_integration_create | User function to attach to event |
void dpp::cluster::on_integration_delete | ( | std::function< void(const integration_delete_t &_event)> | _integration_delete | ) |
Called when an integration is removed by a user. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc.
_integration_delete | User function to attach to event |
void dpp::cluster::on_integration_update | ( | std::function< void(const integration_update_t &_event)> | _integration_update | ) |
Called when an integration is updated by a user. This returns details of just the single integration that has changed. An integration is a connection to a guild of a user's associated accounts, e.g. youtube or twitch, for automatic assignment of roles etc.
_integration_update | User function to attach to event |
void dpp::cluster::on_interaction_create | ( | std::function< void(const interaction_create_t &_event)> | _interaction_create | ) |
Called when a new interaction is created. Interactions are created by discord when commands you have registered are issued by a user. For an example of this in action please see Using Slash Commands and Interactions.
_interaction_create | User function to attach to event |
void dpp::cluster::on_invite_create | ( | std::function< void(const invite_create_t &_event)> | _invite_create | ) |
Called when a new invite is created for a guild.
_invite_create | User function to attach to event |
void dpp::cluster::on_invite_delete | ( | std::function< void(const invite_delete_t &_event)> | _invite_delete | ) |
Called when an invite is deleted from a guild.
_invite_delete | User function to attach to event |
void dpp::cluster::on_log | ( | std::function< void(const log_t &_event)> | _log | ) |
Called when a log message is to be written to the log. You can attach any logging system here you wish, e.g. spdlog, or even just a simple use of std::cout or printf. If nothing attaches this log event, then the library will be silent.
_log | User function to attach to event |
void dpp::cluster::on_message_create | ( | std::function< void(const message_create_t &_event)> | _message_create | ) |
Called when a new message arrives from discord. Note that D++ does not cache messages. If you want to cache these objects you should create something yourself within your bot. Caching of messages is not on the roadmap to be supported as it consumes excessive amounts of RAM.
_message_create | User function to attach to event |
void dpp::cluster::on_message_delete | ( | std::function< void(const message_delete_t &_event)> | _message_delete | ) |
Called when a message is deleted. The message has already been deleted from Discord when you receive this event.
_message_delete | User function to attach to event |
void dpp::cluster::on_message_delete_bulk | ( | std::function< void(const message_delete_bulk_t &_event)> | _message_delete_bulk | ) |
Called when multiple messages are deleted from a channel or DM.
_message_delete_bulk | User function to attach to event |
void dpp::cluster::on_message_reaction_add | ( | std::function< void(const message_reaction_add_t &_event)> | _message_reaction_add | ) |
Called when a new reaction is added to a message.
_message_reaction_add | User function to attach to event |
void dpp::cluster::on_message_reaction_remove | ( | std::function< void(const message_reaction_remove_t &_event)> | _message_reaction_remove | ) |
Called when a single reaction is removed from a message.
_message_reaction_remove | User function to attach to event |
void dpp::cluster::on_message_reaction_remove_all | ( | std::function< void(const message_reaction_remove_all_t &_event)> | _message_reaction_remove_all | ) |
Called when all reactions are removed from a message.
_message_reaction_remove_all | User function to attach to event |
void dpp::cluster::on_message_reaction_remove_emoji | ( | std::function< void(const message_reaction_remove_emoji_t &_event)> | _message_reaction_remove_emoji | ) |
Called when all reactions for a particular emoji are removed from a message.
_message_reaction_remove_emoji | User function to attach to event |
void dpp::cluster::on_message_update | ( | std::function< void(const message_update_t &_event)> | _message_update | ) |
Called when a message is updated (edited).
_message_update | User function to attach to event |
void dpp::cluster::on_presence_update | ( | std::function< void(const presence_update_t &_event)> | _presence_update | ) |
Called when a user's presence is updated. To receive these you will need the GUILD_PRESENCES privileged intent. You will receive many of these, very often, and receiving them will significaintly increase your bot's CPU usage. If you don't need them it is recommended to not ask for them.
_presence_update | User function to attach to event |
void dpp::cluster::on_ready | ( | std::function< void(const ready_t &_event)> | _ready | ) |
Called when a shard is connected and ready. A set of on_guild_create events will follow this event.
_ready | User function to attach to event |
void dpp::cluster::on_resumed | ( | std::function< void(const resumed_t &_event)> | _resumed | ) |
Called when a connection to a shard successfully resumes. A resumed session does not need to re-synchronise guilds, members, etc. This is generally non-fatal and informational only.
_resumed | User function to attach to event |
void dpp::cluster::on_select_click | ( | std::function< void(const select_click_t &_event)> | _select_click | ) |
Called when a select menu is clicked attached to a message. Select menu clicks are triggered by discord when select menus are clicked which you have associated with a message using dpp::component.
_select_click | User function to attach to event |
void dpp::cluster::on_stage_instance_create | ( | std::function< void(const stage_instance_create_t &_event)> | _stage_instance_create | ) |
Called when a new stage instance is created on a stage channel.
_stage_instance_create | User function to attach to event |
void dpp::cluster::on_stage_instance_delete | ( | std::function< void(const stage_instance_delete_t &_event)> | _stage_instance_delete | ) |
Called when an existing stage instance is deleted from a stage channel.
_stage_instance_delete | User function to attach to event |
void dpp::cluster::on_thread_create | ( | std::function< void(const thread_create_t &_event)> | _thread_create | ) |
Called when a thread is created Note: Threads are not cached by D++, but a list of thread IDs is accessible in a guild object.
_thread_create | User function to attach to event |
void dpp::cluster::on_thread_delete | ( | std::function< void(const thread_delete_t &_event)> | _thread_delete | ) |
Called when a thread is deleted.
_thread_delete | User function to attach to event |
void dpp::cluster::on_thread_list_sync | ( | std::function< void(const thread_list_sync_t &_event)> | _thread_list_sync | ) |
Called when thread list is synced (upon gaining access to a channel) Note: Threads are not cached by D++, but a list of thread IDs is accessible in a guild object.
_thread_list_sync | User function to attach to event |
void dpp::cluster::on_thread_member_update | ( | std::function< void(const thread_member_update_t &_event)> | _thread_member_update | ) |
Called when current user's thread member object is updated.
_thread_member_update | User function to attach to event |
void dpp::cluster::on_thread_members_update | ( | std::function< void(const thread_members_update_t &_event)> | _thread_members_update | ) |
Called when a thread's member list is updated (without GUILD_MEMBERS intent, is only called for current user)
_thread_members_update | User function to attach to event |
void dpp::cluster::on_thread_update | ( | std::function< void(const thread_update_t &_event)> | _thread_update | ) |
Called when a thread is updated.
_thread_update | User function to attach to event |
void dpp::cluster::on_typing_start | ( | std::function< void(const typing_start_t &_event)> | _typing_start | ) |
Called when a user is typing on a channel.
_typing_start | User function to attach to event |
void dpp::cluster::on_user_update | ( | std::function< void(const user_update_t &_event)> | _user_update | ) |
Called when a user is updated. This is separate to guild_member_update and includes things such as an avatar change, username change, discriminator change or change in subscription status for nitro.
_user_update | User function to attach to event |
void dpp::cluster::on_voice_buffer_send | ( | std::function< void(const voice_buffer_send_t &_event)> | _voice_buffer_send | ) |
Called when packets are sent from the voice buffer. The voice buffer contains packets that are already encoded with Opus and encrypted with Sodium, and merged into packets by the repacketizer, which is done in the dpp::discord_voice_client::send_audio method. You should use the buffer size properties of dpp::voice_buffer_send_t to determine if you should fill the buffer with more content.
_voice_buffer_send | User function to attach to event |
void dpp::cluster::on_voice_client_disconnect | ( | std::function< void(const voice_client_disconnect_t &_event)> | _voice_client_disconnect | ) |
on voice client disconnect event
_voice_state_update | User function to attach to event |
void dpp::cluster::on_voice_client_speaking | ( | std::function< void(const voice_client_speaking_t &_event)> | _voice_client_speaking | ) |
on voice client speaking event
_voice_state_update | User function to attach to event |
void dpp::cluster::on_voice_ready | ( | std::function< void(const voice_ready_t &_event)> | _voice_ready | ) |
Called when a voice channel is connected and ready to send audio. Note that this is not directly attached to the READY event of the websocket, as there is further connection that needs to be done before audio is ready to send.
_voice_ready | User function to attach to event |
void dpp::cluster::on_voice_receive | ( | std::function< void(const voice_receive_t &_event)> | _voice_receive | ) |
Called when new audio data is received. Each separate user's audio from the voice channel will arrive tagged with their user id in the event, if a user can be attributed to the received audio.
_voice_receive | User function to attach to event |
void dpp::cluster::on_voice_server_update | ( | std::function< void(const voice_server_update_t &_event)> | _voice_server_update | ) |
Called when we are told which voice server we can use. This will be sent either when we establish a new voice channel connection, or as discord rearrange their infrastructure.
_voice_server_update | User function to attach to event |
void dpp::cluster::on_voice_state_update | ( | std::function< void(const voice_state_update_t &_event)> | _voice_state_update | ) |
on voice state update event
_voice_state_update | User function to attach to event |
void dpp::cluster::on_voice_track_marker | ( | std::function< void(const voice_track_marker_t &_event)> | _voice_track_marker | ) |
Called when sending of audio passes over a track marker. Track markers are arbitrarily placed "bookmarks" in the audio buffer, placed by the bot developer. Each track marker can have a string value associated with it which is specified in dpp::discord_voice_client::insert_marker and returned to this event.
_voice_track_marker | User function to attach to event |
void dpp::cluster::on_voice_user_talking | ( | std::function< void(const voice_user_talking_t &_event)> | _voice_user_talking | ) |
Called when a user is talking on a voice channel.
_voice_user_talking | User function to attach to event |
void dpp::cluster::on_webhooks_update | ( | std::function< void(const webhooks_update_t &_event)> | _webhooks_update | ) |
Called when the webhooks for a guild are updated.
_webhooks_update | User function to attach to event |
void dpp::cluster::pins_get | ( | snowflake | channel_id, |
command_completion_event_t | callback | ||
) |
Get a channel's pins.
channel_id | Channel ID to get pins for |
callback | Function to call when the API call completes. |
void dpp::cluster::post_rest | ( | const std::string & | endpoint, |
const std::string & | major_parameters, | ||
const std::string & | parameters, | ||
http_method | method, | ||
const std::string & | postdata, | ||
json_encode_t | callback, | ||
const std::string & | filename = "" , |
||
const std::string & | filecontent = "" |
||
) |
Post a REST request. Where possible use a helper method instead like message_create.
endpoint | Endpoint to post to, e.g. /api/guilds |
major_parameters | Major parameters for the endpoint e.g. a guild id |
parameters | Minor parameters for the API request |
method | Method, e.g. GET, POST |
postdata | Post data (usually JSON encoded) |
callback | Function to call when the HTTP call completes. The callback parameter will contain amongst other things, the decoded json. |
filename | Filename to post for POST requests (for uploading files) |
filecontent | File content to post for POST requests (for uploading files) |
void dpp::cluster::request | ( | const std::string & | url, |
http_method | method, | ||
http_completion_event | callback, | ||
const std::string & | postdata = "" , |
||
const std::string & | mimetype = "text/plain" , |
||
const std::multimap< std::string, std::string > & | headers = {} |
||
) |
Make a HTTP(S) request. For use when wanting asnyncronous access to HTTP APIs outside of Discord.
url | Endpoint to post to, e.g. /api/guilds |
method | Method, e.g. GET, POST |
callback | Function to call when the HTTP call completes. No processing is done on the returned data. |
postdata | POST data |
mimetype | MIME type of POST data |
headers | Headers to send with the request |
void dpp::cluster::role_create | ( | const class role & | r, |
command_completion_event_t | callback = {} |
||
) |
Create a role on a guild.
r | Role to create (guild ID is encapsulated in the role object) |
callback | Function to call when the API call completes. |
void dpp::cluster::role_delete | ( | snowflake | guild_id, |
snowflake | role_id, | ||
command_completion_event_t | callback = {} |
||
) |
Delete a role.
guild_id | Guild ID to delete the role on |
role_id | Role ID to delete |
callback | Function to call when the API call completes. |
void dpp::cluster::role_edit | ( | const class role & | r, |
command_completion_event_t | callback = {} |
||
) |
Edit a role on a guild.
r | Role to edit |
callback | Function to call when the API call completes. |
void dpp::cluster::role_edit_position | ( | const class role & | r, |
command_completion_event_t | callback = {} |
||
) |
Edit a role's position in a guild.
r | Role to change position of |
callback | Function to call when the API call completes. |
void dpp::cluster::roles_get | ( | snowflake | guild_id, |
command_completion_event_t | callback | ||
) |
Get a role for a guild.
guild_id | Guild ID to get role for |
callback | Function to call when the API call completes. |
Set the dm channel id for a user id.
user_id | user id to set the dm channel for |
channel_id | dm channel to set |
void dpp::cluster::set_presence | ( | const class dpp::presence & | p | ) |
Set the presence for all shards on the cluster.
p | The presence to set. Only the online status and the first activity are sent. |
void dpp::cluster::start | ( | bool | return_after = true | ) |
Start the cluster, connecting all its shards. Returns once all shards are connected.
return_after | If true the bot will return to your program after starting shards, if false this function will never return. |
void dpp::cluster::sticker_packs_get | ( | command_completion_event_t | callback | ) |
Get sticker packs.
callback | Function to call when the API call completes. On success the callback will contain a dpp::sticker object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). |
void dpp::cluster::template_get | ( | const std::string & | code, |
command_completion_event_t | callback | ||
) |
Get a template.
code | Template code |
callback | Function to call when the API call completes. |
void dpp::cluster::thread_create | ( | const std::string & | thread_name, |
snowflake | channel_id, | ||
uint16_t | auto_archive_duration, | ||
channel_type | thread_type, | ||
command_completion_event_t | callback = {} |
||
) |
Create a thread.
thread_name | Name of the thread |
channel_id | Channel in which thread to create |
auto_archive_duration | Duration after which thread auto-archives. Can be set to - 60, 1440 (for boosted guilds can also be: 4320, 10080) |
thread_type | Type of thread - GUILD_PUBLIC_THREAD, GUILD_NEWS_THREAD, GUILD_PRIVATE_THREAD |
callback | Function to call when the API call completes. |
void dpp::cluster::thread_create_with_message | ( | const std::string & | thread_name, |
snowflake | channel_id, | ||
snowflake | message_id, | ||
uint16_t | auto_archive_duration, | ||
command_completion_event_t | callback = {} |
||
) |
Create a thread with a message (Discord: ID of a thread is same as message ID)
thread_name | Name of the thread |
channel_id | Channel in which thread to create |
message_id | message to start thread with |
auto_archive_duration | Duration after which thread auto-archives. Can be set to - 60, 1440 (for boosted guilds can also be: 4320, 10080) |
callback | Function to call when the API call completes. |
void dpp::cluster::thread_member_add | ( | snowflake | thread_id, |
snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Add a member to a thread.
thread_id | Thread ID to add to |
user_id | Member ID to add |
callback | Function to call when the API call completes. |
void dpp::cluster::thread_member_remove | ( | snowflake | thread_id, |
snowflake | user_id, | ||
command_completion_event_t | callback = {} |
||
) |
Remove a member from a thread.
thread_id | Thread ID to remove from |
user_id | Member ID to remove |
callback | Function to call when the API call completes. |
dpp::utility::uptime dpp::cluster::uptime | ( | ) |
Returns the uptime of the cluster.
void dpp::cluster::user_get | ( | snowflake | user_id, |
command_completion_event_t | callback | ||
) |
Get a user by id.
user_id | User ID to retrieve |
callback | Function to call when the API call completes. |
cache_policy_t dpp::cluster::cache_policy |
uint32_t dpp::cluster::cluster_id |
ID of this cluster, between 0 and MAXCLUSTERS-1 inclusive
dpp::dispatcher dpp::cluster::dispatch |
Routes events from Discord back to user program code via std::functions
uint32_t dpp::cluster::intents |
Current bitmask of gateway intents
time_t dpp::cluster::last_identify |
uint32_t dpp::cluster::maxclusters |
Total number of clusters that are active
dpp::user dpp::cluster::me |
The details of the bot user. This is assumed to be identical across all shards in the cluster. Each connecting shard updates this information.
uint32_t dpp::cluster::numshards |
Total number of shards across all clusters
double dpp::cluster::rest_ping |
REST latency (HTTPS ping)
std::string dpp::cluster::token |
Current bot token for all shards on this cluster and all commands sent via HTTP