![]() |
D++ (DPP)
C++ Discord API Bot Library
|
The main namespace for D++ functions. classes and types. More...
Namespaces | |
cache_policy | |
Contains a set of predefined cache policies for use when constructing a dpp::cluster. | |
colors | |
predefined color constants. | |
dave | |
detail | |
Implementation details for internal use only. | |
embed_type | |
Represents possible values for the dpp::embed type field. These are loosely defined by the API docs and do not influence how the client renders embeds. | |
events | |
Route interaction event. | |
unicode_emoji | |
Emoji unicodes. | |
utility | |
Utility helper functions, generally for logging, running programs, time/date manipulation, etc. | |
Classes | |
struct | active_thread_info |
A thread alongside the bot's optional thread_member object tied to it. More... | |
class | activity |
An activity is a representation of what a user is doing. It might be a game, or a website, or a movie. Whatever. More... | |
struct | activity_assets |
An activity asset are the images and the hover text displayed in the rich presence. More... | |
struct | activity_button |
An activity button is a custom button shown in the rich presence. Can be to join a game or whatever. More... | |
struct | activity_party |
Information for the current party of the player. More... | |
struct | activity_secrets |
Secrets for Rich Presence joining and spectating. More... | |
class | address_t |
Represents an IPv4 address for use with socket functions such as bind(). More... | |
class | app_team |
Represents a team of users who maintain a bot/application. More... | |
class | application |
The application class represents details of a bot application. More... | |
struct | application_install_params |
Represents the settings for the bot/application's in-app authorization link. More... | |
class | application_role_connection |
The application role connection that an application has attached to a user. More... | |
class | application_role_connection_metadata |
Application Role Connection Metadata. Represents a role connection metadata for an dpp::application. More... | |
class | async |
A co_await-able object handling an API call in parallel with the caller. More... | |
struct | async_dummy |
struct | attachment |
Represents an attachment in a dpp::message. More... | |
class | audio_mixer |
A class for audio mixing operations using x64 instructions. More... | |
struct | audit_change |
Defines audit log changes. More... | |
struct | audit_entry |
An individual audit log entry. More... | |
struct | audit_extra |
Extra information for an audit log entry. More... | |
class | auditlog |
The auditlog class represents the audit log entries of a guild. More... | |
struct | autocomplete_interaction |
An auto complete interaction. More... | |
struct | autocomplete_t |
Discord requests that we fill a list of auto completion choices for a command option. More... | |
struct | automod_action |
Represents an automod action. More... | |
struct | automod_metadata |
Metadata associated with an automod action. Different fields are relevant based on the value of dpp::automod_rule::trigger_type. More... | |
class | automod_rule |
Represents an automod rule. More... | |
struct | automod_rule_create_t |
Create automod rule. More... | |
struct | automod_rule_delete_t |
Delete automod rule. More... | |
struct | automod_rule_execute_t |
Execute/trigger automod rule. More... | |
struct | automod_rule_update_t |
Update automod rule. More... | |
class | awaitable |
Generic awaitable class, represents a future value that can be co_await-ed on. More... | |
struct | awaitable_dummy |
class | ban |
The ban class represents a ban on a guild. More... | |
class | basic_awaitable |
class | basic_promise |
Generic promise class, represents the owning potion of an asynchronous value. More... | |
class | bignumber |
An arbitrary length integer number. Officially, the Discord documentation says that permission values can be any arbitrary number of digits. At time of writing there are only 50 bits of permissions, but this is set to grow larger and potentially past 64 bits. They will continue to send this data as a huge single integer at that point, because this is obviously sensible. /s. More... | |
struct | bucket_t |
A rate limit bucket. The library builds one of these for each endpoint. More... | |
struct | button_click_t |
Click on button. More... | |
class | cache |
A cache object maintains a cache of dpp::managed objects. More... | |
class | cache_exception |
Represents invalid access to dpp's cache or its members, which may or may not exist. More... | |
struct | cache_policy_t |
Represents the caching policy of the cluster. More... | |
class | channel |
A definition of a discord channel. There are one of these for every channel type except threads. Threads are special snowflakes. Get it? A Discord pun. Hahaha. .... I'll get my coat. More... | |
class | channel_collector |
Channel collector. Collects channels during a set timeframe and returns them in a list via the completed() method. More... | |
struct | channel_create_t |
Create channel. More... | |
struct | channel_delete_t |
Delete channel. More... | |
struct | channel_pins_update_t |
Channel pins update. More... | |
struct | channel_update_t |
Update channel. More... | |
class | cluster |
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... | |
class | collected_reaction |
Represents a reaction. Can be filled for use in a collector. More... | |
class | collector |
Collects objects from events during a specified time period. More... | |
struct | command_data_option |
Values in the command interaction. These are the values specified by the user when actually issuing the command on a channel or in DM. More... | |
struct | command_info_t |
Represents the details of a command added to the command handler class. More... | |
struct | command_interaction |
Details of a command within an interaction. This subobject represents the application command associated with the interaction. More... | |
struct | command_option |
Each command option is a command line parameter. It can have a type (see dpp::command_option_type), a name, a description, can be required or optional, and can have zero or more choices (for multiple choice), plus options. Adding options acts like sub-commands and can contain more options. More... | |
struct | command_option_choice |
This struct represents choices in a multiple choice option for a command parameter. It has both a string name, and a value parameter which is a variant, meaning it can hold different potential types (see dpp::command_value) that you can retrieve with std::get(). More... | |
class | command_permission |
Application command permissions allow you to enable or disable commands for specific users or roles within a guild. More... | |
struct | command_resolved |
Resolved snowflake ids to users, guild members, roles and channels. You can use the interaction::get_resolved_* methods to easily get a resolved set. More... | |
struct | command_source |
Represents the sending source of a command. This is passed to any command handler and should be passed back to commandhandler::reply(), allowing the reply method to route any replies back to the origin, which may be a slash command or a message. Both require different response facilities but we want this to be transparent if you use the command handler class. More... | |
class | component |
Represents the component object. A component is a clickable button or drop down list within a discord message, where the buttons emit on_button_click events when the user interacts with them. More... | |
struct | component_default_value |
A Default value structure for components. More... | |
struct | component_interaction |
A button click for a button component. More... | |
struct | confirmation |
Confirmation object represents any true or false simple REST request. More... | |
struct | confirmation_callback_t |
The results of a REST call wrapped in a convenient struct. More... | |
class | connection |
The connection object that the user has attached. More... | |
class | connection_exception |
Represents an error establishing or maintaining a connection. More... | |
struct | context_menu_t |
Base class for context menu interactions, e.g. right click on user or message. More... | |
class | coroutine |
Base type for a coroutine, starts on co_await. More... | |
struct | coroutine_dummy |
struct | dave_binary_header_t |
DAVE E2EE Binary frame header. More... | |
class | discord_client |
Implements a discord client. Each discord_client connects to one shard and derives from a websocket client. More... | |
class | discord_voice_client |
Implements a discord voice connection. Each discord_voice_client connects to one voice channel and derives from a websocket client. More... | |
struct | discord_webhook_server |
Creates a HTTP server which listens for incoming Discord interactions, and if verified as valid, raises them as cluster events, returning the response back. Note that Discord requires all interaction endpoints to have a valid SSL certificate (not self signed) so in most cases you should put this port behind a reverse proxy, e.g. nginx, apache, etc. More... | |
struct | dns_cache_entry |
Represents a cached DNS result. Used by the ssl_connection class to store cached copies of dns lookups. More... | |
class | dtemplate |
Represents a guild template. More... | |
struct | embed |
A rich embed for display within a dpp::message. More... | |
struct | embed_author |
Author within a dpp::embed object. More... | |
struct | embed_field |
A dpp::embed may contain zero or more fields. More... | |
struct | embed_footer |
A footer in a dpp::embed. More... | |
struct | embed_image |
An video, image or thumbnail in a dpp::embed or dpp::component (v2) More... | |
struct | embed_provider |
Embed provider in a dpp::embed. Received from discord but cannot be sent. More... | |
class | emoji |
Represents an emoji for a dpp::guild. More... | |
class | entitlement |
A definition of a discord entitlement. More... | |
struct | entitlement_create_t |
Delete stage instance. More... | |
struct | entitlement_delete_t |
Delete stage instance. More... | |
struct | entitlement_update_t |
Delete stage instance. More... | |
struct | error_detail |
The details of a field in an error response. More... | |
struct | error_info |
The full details of an error from a REST response. More... | |
struct | etf_buffer |
Represents a buffer of bytes being encoded into ETF. More... | |
class | etf_parser |
The etf_parser class can serialise and deserialise ETF (Erlang Term Format) into and out of an nlohmann::json object, so that layers above the websocket don't have to be any different for handling ETF. More... | |
struct | event_dispatch_t |
Base event parameter struct. Each event you receive from the library will have its parameter derived from this class. The class contains the raw event data, and a pointer to the current shard's dpp::discord_client object. You can also use this object to cancel the current event, meaning that any listeners after yours do not get notified of the current event if you call it. More... | |
struct | event_entities |
Entities for the event. More... | |
struct | event_member |
Represents a guild member/user who has registered interest in an event. More... | |
class | event_router_t |
Handles routing of an event to multiple listeners. Multiple listeners may attach to the event_router_t by means of operator(). Passing a lambda into operator() attaches to the event. More... | |
class | exception |
The dpp::exception class derives from std::exception and supports some other ways of passing in error details such as via std::string. More... | |
class | file_exception |
Represents an error reading or writing to a file. More... | |
struct | form_submit_t |
On form submitted. More... | |
struct | forum_tag |
Represents a tag that is able to be applied to a thread in a forum or media channel. More... | |
struct | gateway |
Represents the various information from the 'get gateway bot' api call. More... | |
class | guild |
Represents a guild on Discord (AKA a server) More... | |
struct | guild_audit_log_entry_create_t |
Guild audit log entry create. More... | |
struct | guild_ban_add_t |
Guild ban add. More... | |
struct | guild_ban_remove_t |
Guild ban remove. More... | |
class | guild_command_permissions |
Returned when fetching the permissions for a command in a guild. More... | |
struct | guild_create_t |
Create guild. More... | |
struct | guild_delete_t |
Delete guild. More... | |
struct | guild_emojis_update_t |
Guild emojis update. More... | |
struct | guild_integrations_update_t |
Guild integrations update. More... | |
struct | guild_join_request_delete_t |
Guild join request delete (user declined membership screening) More... | |
class | guild_member |
Represents dpp::user membership upon a dpp::guild. This contains the user's nickname, guild roles, and any other guild-specific flags. More... | |
struct | guild_member_add_t |
Guild member add. More... | |
struct | guild_member_remove_t |
Guild member remove. More... | |
struct | guild_member_update_t |
Guild member update. More... | |
struct | guild_members_chunk_t |
Guild members chunk. More... | |
struct | guild_role_create_t |
Guild role create. More... | |
struct | guild_role_delete_t |
Guild role delete. More... | |
struct | guild_role_update_t |
Guild role update. More... | |
struct | guild_scheduled_event_create_t |
Create scheduled event. More... | |
struct | guild_scheduled_event_delete_t |
Delete scheduled event. More... | |
struct | guild_scheduled_event_update_t |
Create scheduled event. More... | |
struct | guild_scheduled_event_user_add_t |
Add user to scheduled event. More... | |
struct | guild_scheduled_event_user_remove_t |
Delete user from scheduled event. More... | |
struct | guild_stickers_update_t |
Update guild stickers. More... | |
struct | guild_update_t |
Guild update. More... | |
class | guild_widget |
Represents a guild widget, simple web widget of member list. More... | |
struct | http_connect_info |
Represents a HTTP scheme, hostname and port split into parts for easy use in https_client. More... | |
class | http_request |
A HTTP request. More... | |
struct | http_request_completion_t |
The result of any HTTP request. Contains the headers, vital rate limit figures, and returned request body. More... | |
struct | http_server |
Creates a simple HTTP server which listens on a TCP port for a plaintext or SSL incoming request, and passes that request to a callback to generate the response. More... | |
class | http_server_request |
class | https_client |
Implements a HTTPS socket client based on the SSL client. More... | |
class | integration |
Represents an integration on a guild, e.g. a connection to twitch. More... | |
struct | integration_account |
The account information for an integration. More... | |
struct | integration_app |
An application that has been integrated. More... | |
struct | integration_configuration |
Configuration object for an app installation. More... | |
struct | integration_create_t |
Integration create. More... | |
struct | integration_delete_t |
Integration delete. More... | |
struct | integration_update_t |
Integration update. More... | |
class | interaction |
An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event. This is further split into the events on_form_submit, on_slashcommand, on_user_context_menu, on_button_click, on_select_menu, etc. More... | |
struct | interaction_create_t |
Create interaction. More... | |
struct | interaction_metadata_type |
Metadata about the interaction, including the source of the interaction and relevant server and user IDs. More... | |
struct | interaction_modal_response |
Represents a modal dialog box response to an interaction. More... | |
struct | interaction_response |
A response to an interaction, used to reply to a command and initiate a message, which can be hidden from others (ephemeral) or visible to all. More... | |
class | invalid_token_exception |
Represents an attempt to construct a cluster with an invalid bot token. More... | |
class | invite |
Represents an invite to a discord guild or channel. More... | |
struct | invite_create_t |
Invite create. More... | |
struct | invite_delete_t |
Invite delete. More... | |
class | job |
Extremely light coroutine object designed to send off a coroutine to execute on its own. Can be used in conjunction with coroutine events via event routers, or on its own. More... | |
struct | job_dummy |
struct | json_interface |
Represents an interface for an object that can optionally implement functions for converting to and from nlohmann::json. The methods are only present if the actual object also has those methods. More... | |
class | length_exception |
Represents invalid length of argument being passed to a function. More... | |
struct | log_t |
Log messages. More... | |
class | logic_exception |
Represents an error in logic, e.g. you asked the library to do something the Discord API does not support. More... | |
class | managed |
The managed class is the base class for various types that can be stored in a cache that are identified by a dpp::snowflake id. More... | |
struct | message |
Represents messages sent and received on Discord. More... | |
class | message_collector |
Message collector. Collects messages during a set timeframe and returns them in a list via the completed() method. More... | |
struct | message_context_menu_t |
Event parameter for context menu interactions for messages. More... | |
struct | message_create_t |
Create message. More... | |
struct | message_delete_bulk_t |
Message delete bulk. More... | |
struct | message_delete_t |
Message Deleted. More... | |
struct | message_file_data |
The data for a file attached to a message. More... | |
struct | message_poll_vote_add_t |
Message poll vote add. More... | |
struct | message_poll_vote_remove_t |
Message poll vote remove. More... | |
struct | message_reaction_add_t |
Message reaction add. More... | |
struct | message_reaction_remove_all_t |
Message remove all reactions. More... | |
struct | message_reaction_remove_emoji_t |
Message remove emoji. More... | |
struct | message_reaction_remove_t |
Message reaction remove. More... | |
struct | message_snapshot |
struct | message_update_t |
Message update. More... | |
class | moveable_promise |
Generic promise class, represents the owning potion of an asynchronous value. More... | |
struct | moving_averager |
struct | multipart_content |
Represents a multipart mime body and the correct top-level mime type If a non-multipart request is passed in, this is represented as a plain body and the application/json mime type. More... | |
struct | onboarding |
Represents a guild's onboarding flow. More... | |
struct | onboarding_prompt |
Represents an onboarding prompt. More... | |
struct | onboarding_prompt_option |
Represents an onboarding prompt option. More... | |
class | oneshot_timer |
Trigger a timed event once. The provided callback is called only once. More... | |
struct | param_info |
Details of a command parameter used in registration. Note that for non-slash commands optional parameters can only be at the end of the list of parameters. More... | |
class | parse_exception |
Represents inability to parse data, usually caused by malformed JSON or ETF. More... | |
struct | partial_emoji |
An emoji reference for a component (select menus included) or a poll. More... | |
class | permission |
Represents a permission bitmask (refer to enum dpp::permissions) which are held in an uint64_t. More... | |
struct | permission_overwrite |
Channel permission overwrites. More... | |
struct | poll |
Represents a poll. More... | |
struct | poll_answer |
Represents an answer in a poll. More... | |
struct | poll_media |
Structure representing a poll media, for example the poll question or a possible poll answer. More... | |
struct | poll_results |
Represents the results of a poll. More... | |
class | presence |
Represents user presence, e.g. what game they are playing and if they are online. More... | |
struct | presence_update_t |
Presence update. More... | |
struct | prune |
Defines a request to count prunable users, or start a prune operation. More... | |
struct | raii_socket |
Allocates a dpp::socket, closing it on destruction. More... | |
struct | reaction |
Represents a reaction to a dpp::message. More... | |
class | reaction_collector |
Reaction collector. Collects message reactions during a set timeframe and returns them in a list via the completed() method. More... | |
struct | ready_t |
Session ready. More... | |
class | request_concurrency_queue |
Represents a timer instance in a pool handling requests to HTTP(S) servers. There are several of these, the total defined by a constant in cluster.cpp, and each one will always receive requests for the same rate limit bucket based on its endpoint portion of the url. This makes rate limit handling reliable and easy to manage. Each of these also has its own mutex, making it thread safe to call and use these from anywhere in the code. More... | |
class | request_queue |
The request_queue class manages rate limits and marshalls HTTP requests that have been built as http_request objects. More... | |
struct | resolved_user |
dpp::resolved_user contains both a dpp::guild_member and a dpp::user. The user can be used to obtain in-depth user details such as if they are nitro, and the guild member information to check their roles on a guild etc. The Discord API provides both if a parameter is a user ping, so we offer both in a combined structure. More... | |
class | rest_exception |
Represents an error on a REST API call, e.g. a HTTPS request. More... | |
struct | resumed_t |
Session resumed. More... | |
class | role |
Represents a role within a dpp::guild. Roles are combined via logical OR of the permission bitmasks, then channel-specific overrides can be applied on top, deny types apply a logic NOT to the bit mask, and allows apply a logical OR. More... | |
class | role_collector |
Role collector. Collects guild roles during a set timeframe and returns them in a list via the completed() method. More... | |
struct | scheduled_event |
A scheduled event. More... | |
class | scheduled_event_collector |
Scheduled event collector. Collects messages during a set timeframe and returns them in a list via the completed() method. More... | |
struct | select_click_t |
Click on select. More... | |
struct | select_option |
An option for a select component. More... | |
class | signature_verifier |
Verifies signatures on incoming webhooks using OpenSSL. More... | |
class | sku |
A definition of a discord SKU. More... | |
class | slashcommand |
Represents an application command, created by your bot either globally, or on a guild. More... | |
struct | slashcommand_t |
User has issued a slash command. More... | |
class | snowflake |
A container for a 64 bit unsigned value representing many things on discord. This value is known in distributed computing as a snowflake value. More... | |
struct | socket_close_t |
Closure of socket (removal from socket engine) More... | |
struct | socket_engine_base |
This is the base class for socket engines. The actual implementation is OS specific and the correct implementation is detected by CMake. It is then compiled specifically into DPP so only one implementation can exist in the implementation. All implementations should behave identically to the user, abstracting out implementation-specific behaviours (e.g. difference between edge and level triggered event mechanisms etc). More... | |
struct | socket_events |
Represents an active socket event set in the socket engine. More... | |
struct | socket_listener |
Listens on a TCP socket for new connections, and whenever a new connection is received, accept it and spawn a new connection of type T. More... | |
struct | socket_stats |
Contains statistics about the IO loop. More... | |
class | ssl_connection |
Implements a simple non-blocking SSL stream connection. More... | |
struct | stage_instance |
A stage instance. Stage instances are like a conference facility, with moderators/speakers and listeners. More... | |
struct | stage_instance_create_t |
Create stage instance. More... | |
struct | stage_instance_delete_t |
Delete stage instance. More... | |
struct | stage_instance_update_t |
Update stage instance. More... | |
struct | sticker |
Represents stickers received in messages. More... | |
struct | sticker_pack |
Represents a sticker pack (the built in groups of stickers that all nitro users get to use) More... | |
class | task |
A coroutine task. It starts immediately on construction and can be co_await-ed, making it perfect for parallel coroutines returning a value. More... | |
class | task_cancelled_exception |
Represents the cancellation of a task. Will be thrown to the awaiter of a cancelled task. More... | |
struct | task_dummy |
class | team_member |
Represents a team member on a team who maintain a bot/application. More... | |
class | thread |
A definition of a discord thread. A thread is a superset of a channel. Not to be confused with std::thread ! More... | |
class | thread_collector |
Thread collector. Collects threads during a set timeframe and returns them in a list via the completed() method. More... | |
struct | thread_create_t |
Thread Create. More... | |
struct | thread_delete_t |
Thread Delete. More... | |
struct | thread_list_sync_t |
Thread List Sync. More... | |
struct | thread_member |
represents membership of a user with a thread More... | |
struct | thread_member_update_t |
Thread Member Update. More... | |
struct | thread_members_update_t |
Thread Members Update. More... | |
struct | thread_metadata |
metadata for threads More... | |
struct | thread_pool |
A thread pool contains 1 or more worker threads which accept thread_pool_task lambadas into a queue, which is processed in-order by whichever thread is free. More... | |
struct | thread_pool_task |
A task within a thread pool. A simple lambda that accepts no parameters and returns void. More... | |
struct | thread_pool_task_comparator |
Compares two thread pool tasks by priority. More... | |
struct | thread_update_t |
Thread Update. More... | |
class | timed_listener |
A timed_listener is a way to temporarily attach to an event for a specific timeframe, then detach when complete. A lambda may also be optionally called when the timeout is reached. Destructing the timed_listener detaches any attached event listeners, and cancels any created timers, but does not call any timeout lambda. More... | |
struct | timer_comparator |
Used to compare two timers next tick times in a priority queue. More... | |
struct | timer_t |
Used internally to store state of active timers. More... | |
struct | typing_start_t |
Typing start. More... | |
class | user |
Represents a user on discord. May or may not be a member of a dpp::guild. More... | |
struct | user_context_menu_t |
Event parameter for context menu interactions for users. More... | |
class | user_identified |
A user with additional fields only available via the oauth2 identify scope. These are not included in dpp::user as additional scopes are needed to fetch them which bots do not normally have. More... | |
struct | user_update_t |
User update. More... | |
struct | voice_buffer_send_t |
voice buffer send More... | |
struct | voice_client_disconnect_t |
voice client disconnect event More... | |
struct | voice_client_platform_t |
voice client platform type notification event More... | |
struct | voice_client_speaking_t |
voice client speaking event More... | |
class | voice_exception |
Represents an error with voice processing. More... | |
struct | voice_out_packet |
An opus-encoded RTP packet to be sent out to a voice channel. More... | |
struct | voice_ready_t |
voice ready More... | |
struct | voice_receive_t |
voice receive packet More... | |
struct | voice_server_update_t |
Voice server update. More... | |
struct | voice_state_update_t |
Voice state update. More... | |
struct | voice_track_marker_t |
Voice state update. More... | |
class | voiceconn |
Represents a connection to a voice channel. A client can only connect to one voice channel per guild at a time, so these are stored in a map in the dpp::discord_client keyed by guild_id. More... | |
class | voiceregion |
Represents a voice region on discord. More... | |
class | voicestate |
Represents the voice state of a user on a guild These are stored in the dpp::guild object, and accessible there, or via dpp::channel::get_voice_members. More... | |
class | webhook |
Represents a discord webhook. More... | |
struct | webhooks_update_t |
Webhooks update. More... | |
class | websocket_client |
Implements a websocket client based on the SSL client. More... | |
struct | welcome_channel |
Defines a channel on a server's welcome screen. More... | |
struct | welcome_screen |
Defines a server's welcome screen. More... | |
class | when_any |
Experimental class to co_await on a bunch of awaitable objects, resuming when the first one completes. On completion, returns a result object that contains the index of the awaitable that finished first. A user can call result::index() and result::get<N>() on the result object to get the result, similar to std::variant. More... | |
class | zlibcontext |
This is an opaque class containing zlib library specific structures. This wraps the C pointers needed for zlib with unique_ptr and gives us a nice buffer abstraction so we don't need to wrestle with raw pointers. More... | |
Typedefs | |
typedef std::variant< std::monostate, std::string, int64_t, bool, snowflake, double > | command_value |
This type is a variant that can hold any of the potential native data types represented by the enum dpp::command_option_type. It is used in interactions. More... | |
typedef std::variant< std::monostate, int64_t, double > | command_option_range |
A minimum or maximum value/length for dpp::co_number, dpp::co_integer and dpp::co_string types of a dpp::command_option. The int64_t is for the integer range or string length that can be entered. The double is for the decimal range that can be entered. More... | |
typedef std::unordered_map< snowflake, slashcommand > | slashcommand_map |
A group of application slash commands. More... | |
typedef std::unordered_map< snowflake, guild_command_permissions > | guild_command_permissions_map |
A group of guild command permissions. More... | |
typedef std::unordered_map< snowflake, application > | application_map |
A group of applications. More... | |
typedef std::unordered_map< snowflake, automod_rule > | automod_rule_map |
typedef std::unordered_map< snowflake, ban > | ban_map |
A group of bans. The key is the user ID. More... | |
typedef std::unordered_map< snowflake, channel > | channel_map |
A group of channels. More... | |
typedef dpp::collector< dpp::channel_create_t, dpp::channel > | channel_collector_t |
Template type for base class of channel collector. More... | |
typedef dpp::collector< dpp::thread_create_t, dpp::thread > | thread_collector_t |
Template type for base class of thread collector. More... | |
typedef dpp::collector< dpp::guild_role_create_t, dpp::role > | role_collector_t |
Template type for base class of role collector. More... | |
typedef dpp::collector< dpp::guild_scheduled_event_create_t, dpp::scheduled_event > | scheduled_event_collector_t |
Template type for base class of scheduled event collector. More... | |
typedef dpp::collector< dpp::message_create_t, dpp::message > | message_collector_t |
Template type for base class of message collector. More... | |
typedef dpp::collector< dpp::message_reaction_add_t, dpp::collected_reaction > | reaction_collector_t |
Template type for base class of message reaction collector. More... | |
typedef std::variant< std::monostate, std::string, dpp::role, dpp::channel, dpp::resolved_user, int64_t, bool, double > | command_parameter |
Represents a received parameter. We use variant so that multiple non-related types can be contained within. More... | |
typedef std::vector< std::pair< std::string, param_info > > | parameter_registration_t |
Parameter list used during registration. Note that use of vector/pair is important here to preserve parameter order, as opposed to unordered_map (which doesn't guarantee any order at all) and std::map, which reorders keys alphabetically. More... | |
typedef std::vector< std::pair< std::string, command_parameter > > | parameter_list_t |
Parameter list for a called command. See dpp::parameter_registration_t for an explanation as to why vector is used. More... | |
typedef std::function< void(const std::string &, const parameter_list_t &, command_source)> | command_handler |
The function definition for a command handler. Expects a command name string, and a list of command parameters. More... | |
template<typename T > | |
using | promise = moveable_promise< T > |
using | privacy_code_callback_t = std::function< void(const std::string &)> |
A callback for obtaining a user's privacy code. The privacy code is returned as the parameter to the function. More... | |
using | command_completion_event_t = std::function< void(const confirmation_callback_t &)> |
A function used as a callback for any REST based command. More... | |
using | dns_cache_t = std::unordered_map< std::string, std::unique_ptr< dns_cache_entry > > |
Cache container type. More... | |
typedef std::unordered_map< snowflake, dtemplate > | dtemplate_map |
A container of invites. More... | |
typedef std::unordered_map< snowflake, emoji > | emoji_map |
Group of emojis. More... | |
typedef std::unordered_map< snowflake, entitlement > | entitlement_map |
Group of entitlements. More... | |
typedef size_t | event_handle |
A returned event handle for an event which was attached. More... | |
typedef std::unordered_map< snowflake, guild_member > | members_container |
Guild members container. More... | |
typedef std::unordered_map< snowflake, guild > | guild_map |
A container of guilds. More... | |
typedef std::unordered_map< snowflake, guild_member > | guild_member_map |
A container of guild members. More... | |
using | http_server_request_event = std::function< void(class http_server_request *)> |
Callback type for HTTP server request callbacks. More... | |
typedef std::multimap< std::string, std::string > | http_headers |
Request headers. More... | |
using | https_client_completion_event = std::function< void(class https_client *)> |
typedef std::unordered_map< snowflake, integration > | integration_map |
A group of integrations. More... | |
typedef std::unordered_map< snowflake, connection > | connection_map |
A group of connections. More... | |
typedef std::unordered_map< std::string, invite > | invite_map |
A container of invites. More... | |
using | json = nlohmann::json |
using | component_emoji = partial_emoji |
An emoji for a component. Alias to partial_emoji, for backwards compatibility. More... | |
typedef std::unordered_map< snowflake, message > | message_map |
A group of messages. More... | |
typedef std::unordered_map< snowflake, sticker > | sticker_map |
A group of stickers. More... | |
typedef std::unordered_map< snowflake, sticker_pack > | sticker_pack_map |
A group of sticker packs. More... | |
using | role_permissions = permissions |
Represents the various discord permissions. More... | |
typedef std::unordered_map< snowflake, presence > | presence_map |
A container of presences. More... | |
typedef std::function< void(const http_request_completion_t &)> | http_completion_event |
Results of HTTP requests are called back to these std::function types. More... | |
typedef std::map< uint32_t, class discord_client * > | shard_list |
A list of shards. More... | |
typedef std::map< uint32_t, time_t > | reconnect_list |
List of shards awaiting reconnection, by id with earliest possible reconnect time. More... | |
typedef std::variant< active_threads, application_role_connection, application_role_connection_metadata_list, confirmation, message, message_map, user, user_identified, user_map, guild_member, guild_member_map, channel, channel_map, thread_member, thread_member_map, guild, guild_map, guild_command_permissions, guild_command_permissions_map, role, role_map, invite, invite_map, dtemplate, dtemplate_map, emoji, emoji_map, ban, ban_map, voiceregion, voiceregion_map, voicestate, integration, integration_map, webhook, webhook_map, prune, guild_widget, gateway, interaction, interaction_response, auditlog, slashcommand, slashcommand_map, stage_instance, sticker, sticker_map, sticker_pack, sticker_pack_map, application, application_map, connection, connection_map, thread, thread_map, scheduled_event, scheduled_event_map, event_member, event_member_map, automod_rule, automod_rule_map, onboarding, welcome_screen, entitlement, entitlement_map, sku, sku_map > | confirmable_t |
A container for types that can be returned for a REST API call. More... | |
typedef std::function< void(json &, const http_request_completion_t &)> | json_encode_t |
Automatically JSON encoded HTTP result. More... | |
typedef std::unordered_map< snowflake, role > | role_map |
A group of roles. More... | |
typedef std::vector< application_role_connection_metadata > | application_role_connection_metadata_list |
A group of dpp::application_role_connection_metadata objects. More... | |
typedef std::unordered_map< snowflake, scheduled_event > | scheduled_event_map |
A group of scheduled events. More... | |
typedef std::unordered_map< snowflake, event_member > | event_member_map |
A group of scheduled event members. More... | |
typedef std::unordered_map< snowflake, sku > | sku_map |
Group of SKUs. More... | |
using | socket = int |
Represents a socket file descriptor. This is used to ensure parity between windows and unix-like systems. More... | |
using | socket_read_event = std::function< void(dpp::socket fd, const struct socket_events &)> |
Read ready event. More... | |
using | socket_write_event = std::function< void(dpp::socket fd, const struct socket_events &)> |
Write ready event. More... | |
using | socket_error_event = std::function< void(dpp::socket fd, const struct socket_events &, int error_code)> |
Error event. More... | |
using | socket_container = std::unordered_map< dpp::socket, std::unique_ptr< socket_events > > |
Container of event sets keyed by socket file descriptor. More... | |
typedef std::unordered_map< snowflake, stage_instance > | stage_instance_map |
A group of stage instances. More... | |
typedef std::unordered_map< snowflake, thread_member > | thread_member_map |
A group of thread member objects. the key is the user_id of the dpp::thread_member. More... | |
typedef std::unordered_map< snowflake, thread > | thread_map |
A group of threads. More... | |
using | active_threads = std::map< snowflake, active_thread_info > |
A map of threads alongside optionally the thread_member tied to the bot if it is in the thread. The map's key is the thread id. Returned from the cluster::threads_get_active method. More... | |
using | work_unit = std::function< void()> |
A work unit is a lambda executed in the thread pool. More... | |
typedef size_t | timer |
Represents a timer handle. Returned from cluster::start_timer and used by cluster::stop_timer. This is obtained from a simple incrementing value, internally. More... | |
typedef std::function< void(timer)> | timer_callback_t |
The type for a timer callback. More... | |
typedef std::priority_queue< timer_t, std::vector< timer_t >, timer_comparator > | timer_next_t |
A priority timers, ordered by earliest first so that the head is always the soonest to be due. More... | |
typedef std::set< timer > | timers_deleted_t |
A set of deleted timer handles. More... | |
typedef std::unordered_map< snowflake, user > | user_map |
A group of users. More... | |
typedef std::unordered_map< std::string, voiceregion > | voiceregion_map |
A group of voice regions. More... | |
typedef std::unordered_map< std::string, voicestate > | voicestate_map |
typedef std::unordered_map< snowflake, webhook > | webhook_map |
A group of webhooks. More... | |
Functions | |
void | to_json (nlohmann::json &j, const command_option_choice &choice) |
helper function to serialize a command_option_choice to json More... | |
void | to_json (nlohmann::json &j, const command_option &opt) |
helper function to serialize a command_option to json More... | |
void | from_json (const nlohmann::json &j, command_data_option &cdo) |
helper function to deserialize a command_data_option from json More... | |
void | from_json (const nlohmann::json &j, command_interaction &ci) |
helper function to deserialize a command_interaction from json More... | |
void | from_json (const nlohmann::json &j, component_interaction &bi) |
helper function to deserialize a component_interaction from json More... | |
void | from_json (const nlohmann::json &j, autocomplete_interaction &ai) |
helper function to deserialize an autocomplete_interaction from json More... | |
void | from_json (const nlohmann::json &j, interaction &i) |
helper function to deserialize an interaction from json More... | |
void | to_json (nlohmann::json &j, const command_permission &cp) |
helper function to serialize a command_permission to json More... | |
void | to_json (nlohmann::json &j, const guild_command_permissions &gcp) |
helper function to serialize a guild_command_permissions to json More... | |
void | to_json (nlohmann::json &j, const slashcommand &cmd) |
helper function to serialize a slashcommand to json More... | |
void DPP_EXPORT | garbage_collection () |
DPP_EXPORT class user * | find_user (snowflake id) |
DPP_EXPORT cache< class user > * | get_user_cache () |
DPP_EXPORT uint64_t | get_user_count () |
DPP_EXPORT class guild * | find_guild (snowflake id) |
DPP_EXPORT cache< class guild > * | get_guild_cache () |
DPP_EXPORT uint64_t | get_guild_count () |
DPP_EXPORT class role * | find_role (snowflake id) |
DPP_EXPORT cache< class role > * | get_role_cache () |
DPP_EXPORT uint64_t | get_role_count () |
DPP_EXPORT class channel * | find_channel (snowflake id) |
DPP_EXPORT cache< class channel > * | get_channel_cache () |
DPP_EXPORT uint64_t | get_channel_count () |
DPP_EXPORT class emoji * | find_emoji (snowflake id) |
DPP_EXPORT cache< class emoji > * | get_emoji_cache () |
DPP_EXPORT uint64_t | get_emoji_count () |
void | to_json (nlohmann::json &j, const permission_overwrite &po) |
Serialize a permission_overwrite object to json. More... | |
class DPP_EXPORT | DPP_DEPRECATED ("commandhandler should not be used. Please consider using dpp::cluster::register_command instead.") commandhandler |
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions. More... | |
DPP_CHECK_ABI_COMPAT (async<>, async_dummy) | |
DPP_CHECK_ABI_COMPAT (coroutine< void >, coroutine_dummy) DPP_CHECK_ABI_COMPAT(coroutine< uint64_t > | |
DPP_CHECK_ABI_COMPAT (task< void >, task_dummy) DPP_CHECK_ABI_COMPAT(task< uint64_t > | |
template<typename... Args> | |
when_any (Args...) -> when_any< detail::when_any::awaitable_type< Args >... > | |
uint64_t DPP_EXPORT | snowflake_not_null (const nlohmann::json *j, const char *keyname) |
Returns a snowflake id from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_snowflake_not_null (const nlohmann::json *j, const char *keyname, uint64_t &v) |
Sets a snowflake id from a json field value, if defined, else does nothing. More... | |
void DPP_EXPORT | set_snowflake_array_not_null (const nlohmann::json *j, const char *keyname, std::vector< class snowflake > &v) |
Sets an array of snowflakes from a json field value, if defined, else does nothing. More... | |
void DPP_EXPORT | for_each_json (nlohmann::json *parent, std::string_view key, const std::function< void(nlohmann::json *)> &fn) |
Applies a function to each element of a json array. More... | |
template<class T > | |
void | set_object_array_not_null (nlohmann::json *j, std::string_view key, std::vector< T > &v) |
Sets an array of objects from a json field value, if defined, else does nothing. More... | |
std::string DPP_EXPORT | string_not_null (const nlohmann::json *j, const char *keyname) |
Returns a string from a json field value, if defined, else returns an empty string. More... | |
void DPP_EXPORT | set_string_not_null (const nlohmann::json *j, const char *keyname, std::string &v) |
Sets a string from a json field value, if defined, else does nothing. More... | |
void DPP_EXPORT | set_iconhash_not_null (const nlohmann::json *j, const char *keyname, utility::iconhash &v) |
This is a repeat of set_string_not_null, but takes in a iconhash. More... | |
double DPP_EXPORT | double_not_null (const nlohmann::json *j, const char *keyname) |
Returns a double from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_double_not_null (const nlohmann::json *j, const char *keyname, double &v) |
Sets a double from a json field value, if defined, else does nothing. More... | |
uint64_t DPP_EXPORT | int64_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. DO NOT use this for snowflakes, as usually snowflakes are wrapped in a string! More... | |
void DPP_EXPORT | set_int64_not_null (const nlohmann::json *j, const char *keyname, uint64_t &v) |
Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing. More... | |
uint32_t DPP_EXPORT | int32_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int32_not_null (const nlohmann::json *j, const char *keyname, uint32_t &v) |
Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing. More... | |
uint16_t DPP_EXPORT | int16_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int16_not_null (const nlohmann::json *j, const char *keyname, uint16_t &v) |
Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing. More... | |
uint8_t DPP_EXPORT | int8_not_null (const nlohmann::json *j, const char *keyname) |
Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int8_not_null (const nlohmann::json *j, const char *keyname, uint8_t &v) |
Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing. More... | |
bool DPP_EXPORT | bool_not_null (const nlohmann::json *j, const char *keyname) |
Returns a boolean value from a json field value, if defined, else returns false. More... | |
void DPP_EXPORT | set_bool_not_null (const nlohmann::json *j, const char *keyname, bool &v) |
Sets a boolean from a json field value, if defined, else does nothing. More... | |
time_t DPP_EXPORT | ts_not_null (const nlohmann::json *j, const char *keyname) |
Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns epoch value of 0. More... | |
void DPP_EXPORT | set_ts_not_null (const nlohmann::json *j, const char *keyname, time_t &v) |
Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing. More... | |
std::string DPP_EXPORT | base64_encode (unsigned char const *buf, unsigned int buffer_length) |
Base64 encode data into a string. More... | |
std::string DPP_EXPORT | ts_to_string (time_t ts) |
Convert time_t unix epoch to std::string ISO date/time. More... | |
const DPP_EXPORT dns_cache_entry * | resolve_hostname (const std::string &hostname, const std::string &port) |
Resolve a hostname to an addrinfo. More... | |
template<build_type > | |
bool | validate_configuration () |
void | from_json (const nlohmann::json &j, guild_member &gm) |
helper function to deserialize a guild_member from json More... | |
guild_member DPP_EXPORT | find_guild_member (const snowflake guild_id, const snowflake user_id) |
Get the guild_member from cache of given IDs. More... | |
template<typename T > | |
auto | run_once () |
Run some code within an if() statement only once. More... | |
template<class T > | |
void | rest_request (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing. More... | |
template<> | |
void | rest_request< message > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing (specialised for message) More... | |
template<> | |
void | rest_request< confirmation > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing (specialised for confirmation) More... | |
template<class T > | |
void | rest_request_list (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key="id") |
Templated REST request helper to save on typing (for returned lists) More... | |
template<> | |
void | rest_request_list< invite > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for invites) More... | |
template<> | |
void | rest_request_list< voiceregion > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for voiceregions) More... | |
template<> | |
void | rest_request_list< ban > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for bans) More... | |
template<> | |
void | rest_request_list< sticker_pack > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for sticker packs) More... | |
template<class T > | |
void | rest_request_list (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key, const std::string &root) |
Templated REST request helper to save on typing (for returned lists) More... | |
template<class T > | |
void | rest_request_vector (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing (for returned lists, specialised for objects which doesn't have ids) More... | |
DPP_EXPORT std::unique_ptr< socket_engine_base > | create_socket_engine (class cluster *creator) |
This is implemented by whatever derived form socket_engine takes. More... | |
void | set_signal_handler (int signal) |
Set up a signal handler to be ignored. More... | |
DPP_EXPORT bool | close_socket (dpp::socket sfd) |
Close a socket. More... | |
DPP_EXPORT bool | set_nonblocking (dpp::socket sockfd, bool non_blocking) |
Set a socket to blocking or non-blocking IO. More... | |
template<typename T > | |
std::basic_string< T > | lowercase (const std::basic_string< T > &s) |
Convert a string to lowercase using tolower() More... | |
template<typename T > | |
std::basic_string< T > | uppercase (const std::basic_string< T > &s) |
Convert a string to uppercase using toupper() More... | |
std::string | rtrim (std::string s) |
trim from end of string (right) More... | |
std::string | ltrim (std::string s) |
trim from beginning of string (left) More... | |
std::string | trim (std::string s) |
Trim from both ends of string (right then left) More... | |
template<class T > | |
std::string | comma (T value) |
Add commas to a string (or dots) based on current locale server-side. More... | |
template<typename T > | |
T | from_string (const std::string &s, std::ios_base &(*f)(std::ios_base &)) |
Convert any value from a string to another type using stringstream. The optional second parameter indicates the format of the input string, e.g. std::dec for decimal, std::hex for hex, std::oct for octal. More... | |
template<typename T > | |
T | from_string (const std::string &s) |
Convert any value from a string to another type using stringstream. More... | |
template<uint64_t > | |
uint64_t | from_string (const std::string &s) |
Specialised conversion of uint64_t from string. More... | |
template<uint32_t > | |
uint32_t | from_string (const std::string &s) |
Specialised conversion of uint32_t from string. More... | |
template<int > | |
int | from_string (const std::string &s) |
Specialised conversion of int from string. More... | |
template<typename T > | |
std::string | to_hex (T i, bool leading_zeroes=true) |
Convert a numeric value to hex. More... | |
template<typename T > | |
std::string | leading_zeroes (T i, size_t width) |
Format a numeric type as a string with leading zeroes. More... | |
void | to_json (nlohmann::json &j, const thread_metadata &tmdata) |
Serialize a thread_metadata object to json. More... | |
void | from_json (const nlohmann::json &j, user &u) |
helper function to deserialize a user from json More... | |
void | from_json (const nlohmann::json &j, user_identified &u) |
helper function to deserialize a user_identified from json More... | |
Variables | |
DPP_EXPORT std::unordered_map< managed *, time_t > | deletion_queue |
DPP_EXPORT std::mutex | deletion_mutex |
constexpr uint32_t | NO_SHARDS = ~0U |
Pass this value into the constructor of dpp::cluster for the shard count to create a cluster with no shards. A cluster with no shards does not connect to a websocket, but can still use the event loop to dispatch HTTPS API requests to Discord. This is useful for bots that do not need to receive websocket events as it will save a lot of resources. More... | |
template<typename T > | |
concept | awaitable_type = requires (T expr) { detail::co_await_resolve(expr).await_ready(); } |
Concept to check if a type can be used with co_await. More... | |
constexpr time_t | RECONNECT_INTERVAL = 5 |
How many seconds to wait between (re)connections. DO NOT change this. It is mandated by the Discord API spec! More... | |
constexpr int32_t | opus_sample_rate_hz = 48000 |
Sample rate for OPUS (48khz) More... | |
constexpr int32_t | opus_channel_count = 2 |
Channel count for OPUS (stereo) More... | |
constexpr uint8_t | voice_protocol_version = 8 |
Discord voice protocol version. More... | |
constexpr size_t | send_audio_raw_max_length = 11520 |
constexpr size_t | secret_key_size = 32 |
const uint8_t | FORMAT_VERSION = 131 |
Current ETF format version in use. More... | |
const bool | is_valid_config = validate_configuration<build_type::universal>() |
static const std::string | http_version |
static constexpr const char * | DISCORD_HOST = "https://discord.com" |
enum DPP_EXPORT | message_ref_type |
Message Reference type. More... | |
enum DPP_EXPORT | mrt_forward = 1 |
constexpr uint16_t | DPP_BUFSIZE {16 * 1024} |
SSL_read buffer size. More... | |
constexpr int | ERROR_STATUS {-1} |
Represents a failed socket system call, e.g. connect() failure. More... | |
constexpr int | MAX_RETRIES {4} |
Maximum number of internal connect() retries on TCP connections. More... | |
constexpr uint32_t | MAX_AVATAR_SIZE = 10240 * 1000 |
constexpr size_t | DECOMP_BUFFER_SIZE = 512 * 1024 |
Size of decompression buffer for zlib compressed traffic. More... | |
The main namespace for D++ functions. classes and types.
The main namespace for D++ functions, classes and types.
using dpp::active_threads = typedef std::map<snowflake, active_thread_info> |
A map of threads alongside optionally the thread_member tied to the bot if it is in the thread. The map's key is the thread id. Returned from the cluster::threads_get_active method.
typedef std::unordered_map<snowflake, application> dpp::application_map |
A group of applications.
This is not currently ever sent by Discord API but the DPP standard setup for objects that can be received by REST has the possibility for this, so this exists. Don't ever expect to see one at present.
typedef std::vector<application_role_connection_metadata> dpp::application_role_connection_metadata_list |
A group of dpp::application_role_connection_metadata objects.
typedef std::unordered_map<snowflake, automod_rule> dpp::automod_rule_map |
A group of automod rules.
typedef std::unordered_map<snowflake, ban> dpp::ban_map |
A group of bans. The key is the user ID.
Template type for base class of channel collector.
typedef std::unordered_map<snowflake, channel> dpp::channel_map |
A group of channels.
typedef std::function< void(const confirmation_callback_t &)> dpp::command_completion_event_t |
A function used as a callback for any REST based command.
A callback upon command completion.
typedef std::function<void(const std::string&, const parameter_list_t&, command_source)> dpp::command_handler |
The function definition for a command handler. Expects a command name string, and a list of command parameters.
typedef std::variant<std::monostate, int64_t, double> dpp::command_option_range |
A minimum or maximum value/length for dpp::co_number, dpp::co_integer and dpp::co_string types of a dpp::command_option. The int64_t
is for the integer range or string length that can be entered. The double
is for the decimal range that can be entered.
typedef std::variant<std::monostate, std::string, dpp::role, dpp::channel, dpp::resolved_user, int64_t, bool, double> dpp::command_parameter |
Represents a received parameter. We use variant so that multiple non-related types can be contained within.
typedef std::variant<std::monostate, std::string, int64_t, bool, snowflake, double> dpp::command_value |
This type is a variant that can hold any of the potential native data types represented by the enum dpp::command_option_type. It is used in interactions.
std::monostate indicates an invalid parameter value, e.g. an unfilled optional parameter. std::int64_t will be for all integer options, double for decimal numbers and dpp::snowflake for anything ID related.
You can retrieve them with std::get().
using dpp::component_emoji = typedef partial_emoji |
An emoji for a component. Alias to partial_emoji, for backwards compatibility.
A container for types that can be returned for a REST API call.
typedef std::unordered_map<snowflake, connection> dpp::connection_map |
A group of connections.
using dpp::dns_cache_t = typedef std::unordered_map<std::string, std::unique_ptr<dns_cache_entry> > |
Cache container type.
typedef std::unordered_map<snowflake, dtemplate> dpp::dtemplate_map |
A container of invites.
typedef std::unordered_map<snowflake, emoji> dpp::emoji_map |
Group of emojis.
typedef std::unordered_map<snowflake, entitlement> dpp::entitlement_map |
Group of entitlements.
typedef size_t dpp::event_handle |
A returned event handle for an event which was attached.
typedef std::unordered_map<snowflake, event_member> dpp::event_member_map |
A group of scheduled event members.
typedef std::unordered_map<snowflake, guild_command_permissions> dpp::guild_command_permissions_map |
A group of guild command permissions.
typedef std::unordered_map<snowflake, guild> dpp::guild_map |
A container of guilds.
typedef std::unordered_map<snowflake, guild_member> dpp::guild_member_map |
A container of guild members.
typedef std::function<void(const http_request_completion_t&)> dpp::http_completion_event |
Results of HTTP requests are called back to these std::function types.
typedef std::multimap<std::string, std::string> dpp::http_headers |
Request headers.
using dpp::http_server_request_event = typedef std::function<void(class http_server_request*)> |
Callback type for HTTP server request callbacks.
using dpp::https_client_completion_event = typedef std::function<void(class https_client*)> |
typedef std::unordered_map<snowflake, integration> dpp::integration_map |
A group of integrations.
typedef std::unordered_map<std::string, invite> dpp::invite_map |
A container of invites.
typedef nlohmann::json dpp::json |
typedef std::function<void(json&, const http_request_completion_t&)> dpp::json_encode_t |
Automatically JSON encoded HTTP result.
typedef std::unordered_map<snowflake, guild_member> dpp::members_container |
Guild members container.
Template type for base class of message collector.
typedef std::unordered_map<snowflake, message> dpp::message_map |
A group of messages.
typedef std::vector<std::pair<std::string, command_parameter> > dpp::parameter_list_t |
Parameter list for a called command. See dpp::parameter_registration_t for an explanation as to why vector is used.
typedef std::vector<std::pair<std::string, param_info> > dpp::parameter_registration_t |
Parameter list used during registration. Note that use of vector/pair is important here to preserve parameter order, as opposed to unordered_map (which doesn't guarantee any order at all) and std::map, which reorders keys alphabetically.
typedef std::unordered_map<snowflake, presence> dpp::presence_map |
A container of presences.
using dpp::privacy_code_callback_t = typedef std::function<void(const std::string&)> |
A callback for obtaining a user's privacy code. The privacy code is returned as the parameter to the function.
This is a callback function because DAVE requires use of a very resource intensive SCRYPT call, which uses lots of ram and cpu and take significant time.
using dpp::promise = typedef moveable_promise<T> |
typedef dpp::collector<dpp::message_reaction_add_t, dpp::collected_reaction> dpp::reaction_collector_t |
Template type for base class of message reaction collector.
typedef std::map<uint32_t, time_t> dpp::reconnect_list |
List of shards awaiting reconnection, by id with earliest possible reconnect time.
Template type for base class of role collector.
typedef std::unordered_map<snowflake, role> dpp::role_map |
A group of roles.
using dpp::role_permissions = typedef permissions |
Represents the various discord permissions.
typedef dpp::collector<dpp::guild_scheduled_event_create_t, dpp::scheduled_event> dpp::scheduled_event_collector_t |
Template type for base class of scheduled event collector.
typedef std::unordered_map<snowflake, scheduled_event> dpp::scheduled_event_map |
A group of scheduled events.
typedef std::map<uint32_t, class discord_client*> dpp::shard_list |
A list of shards.
typedef std::unordered_map<snowflake, sku> dpp::sku_map |
Group of SKUs.
typedef std::unordered_map<snowflake, slashcommand> dpp::slashcommand_map |
A group of application slash commands.
using dpp::socket = typedef int |
Represents a socket file descriptor. This is used to ensure parity between windows and unix-like systems.
using dpp::socket_container = typedef std::unordered_map<dpp::socket, std::unique_ptr<socket_events> > |
Container of event sets keyed by socket file descriptor.
using dpp::socket_error_event = typedef std::function<void(dpp::socket fd, const struct socket_events&, int error_code)> |
Error event.
using dpp::socket_read_event = typedef std::function<void(dpp::socket fd, const struct socket_events&)> |
Read ready event.
using dpp::socket_write_event = typedef std::function<void(dpp::socket fd, const struct socket_events&)> |
Write ready event.
typedef std::unordered_map<snowflake, stage_instance> dpp::stage_instance_map |
A group of stage instances.
typedef std::unordered_map<snowflake, sticker> dpp::sticker_map |
A group of stickers.
typedef std::unordered_map<snowflake, sticker_pack> dpp::sticker_pack_map |
A group of sticker packs.
Template type for base class of thread collector.
typedef std::unordered_map<snowflake, thread> dpp::thread_map |
A group of threads.
typedef std::unordered_map<snowflake, thread_member> dpp::thread_member_map |
A group of thread member objects. the key is the user_id of the dpp::thread_member.
typedef size_t dpp::timer |
Represents a timer handle. Returned from cluster::start_timer and used by cluster::stop_timer. This is obtained from a simple incrementing value, internally.
typedef std::function<void(timer)> dpp::timer_callback_t |
The type for a timer callback.
typedef std::priority_queue<timer_t, std::vector<timer_t>, timer_comparator> dpp::timer_next_t |
A priority timers, ordered by earliest first so that the head is always the soonest to be due.
typedef std::set<timer> dpp::timers_deleted_t |
A set of deleted timer handles.
typedef std::unordered_map<snowflake, user> dpp::user_map |
A group of users.
typedef std::unordered_map<std::string, voiceregion> dpp::voiceregion_map |
A group of voice regions.
typedef std::unordered_map<std::string, voicestate> dpp::voicestate_map |
A container of voicestates
typedef std::unordered_map<snowflake, webhook> dpp::webhook_map |
A group of webhooks.
using dpp::work_unit = typedef std::function<void()> |
A work unit is a lambda executed in the thread pool.
enum dpp::activity_flags |
Activity types for rich presence.
enum dpp::activity_type : uint8_t |
enum dpp::application_flags : uint32_t |
Flags for a bot or application.
Application Role Connection Metadata Type.
metadata value
for each user and guilds specify the required guild's configured value
within the guild role settings. enum dpp::attachment_flags : uint8_t |
Bitmask flags for a dpp::attachment.
Enumerator | |
---|---|
a_is_remix | This attachment has been edited using the remix feature on mobile. |
enum dpp::audit_type |
Defines types of audit log entry.
Auto archive duration of threads which will stop showing in the channel list after the specified period of inactivity. Defined as an enum to fit into 1 byte. Internally it'll be translated to minutes to match the API.
enum dpp::automod_action_type : uint8_t |
Action types to perform on filtering.
Enumerator | |
---|---|
amod_action_block_message | Blocks the message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked. |
amod_action_send_alert | Send an alert to a given channel. |
amod_action_timeout | timeout the user
|
enum dpp::automod_event_type : uint8_t |
enum dpp::automod_preset_type : uint8_t |
enum dpp::automod_trigger_type : uint8_t |
Types of moderation to trigger.
Enumerator | |
---|---|
amod_type_keyword | Check if content contains words from a user defined list of keywords (max 6 of this type per guild) |
amod_type_harmful_link | Harmful/malware links.
|
amod_type_spam | Check if content represents generic spam (max 1 of this type per guild) |
amod_type_keyword_preset | Check if content contains words from discord pre-defined wordsets (max 1 of this type per guild) |
amod_type_mention_spam | Check if content contains more mentions than allowed (max 1 of this type per guild) |
|
strong |
Represents the caching policy of a cache in the library.
enum dpp::channel_flags : uint16_t |
Our flags as stored in the object.
Enumerator | |
---|---|
c_nsfw | NSFW Gated Channel. |
c_video_quality_720p | Video quality forced to 720p. |
c_lock_permissions | Lock permissions (only used when updating channel positions) |
c_pinned_thread | Thread is pinned to the top of its parent forum or media channel. |
c_require_tag | Whether a tag is required to be specified when creating a thread in a forum or media channel. Tags are specified in the thread::applied_tags field. |
c_hide_media_download_options | When set hides the embedded media download options. Available only for media channels. |
enum dpp::channel_type : uint8_t |
Flag integers as received from and sent to discord.
Enumerator | |
---|---|
CHANNEL_TEXT | A text channel within a server. |
DM | A direct message between users. |
CHANNEL_VOICE | A voice channel within a server. |
GROUP_DM | a direct message between multiple users
|
CHANNEL_CATEGORY | An organizational category that contains up to 50 channels. |
CHANNEL_ANNOUNCEMENT | A channel that users can follow and cross-post into their own server. |
CHANNEL_STORE | A channel in which game developers can sell their game on Discord.
|
CHANNEL_ANNOUNCEMENT_THREAD | A temporary sub-channel within a |
CHANNEL_PUBLIC_THREAD | A temporary sub-channel within a |
CHANNEL_PRIVATE_THREAD | A temporary sub-channel within a |
CHANNEL_STAGE | A "stage" channel, like a voice channel with one authorised speaker. |
CHANNEL_DIRECTORY | The channel in a hub containing the listed servers. |
CHANNEL_FORUM | Forum channel that can only contain threads. |
CHANNEL_MEDIA | Media channel that can only contain threads, similar to forum channels. |
enum dpp::client_platform_t : uint8_t |
enum dpp::command_option_type : uint8_t |
Represents command option types. These are the possible parameter value types.
type of permission in the dpp::command_permission class
Enumerator | |
---|---|
cpt_role | Role permission. |
cpt_user | User permission. |
Represents the type of a dpp::component_default_value
Enumerator | |
---|---|
cdt_user | |
cdt_role | |
cdt_channel |
enum dpp::component_style : uint8_t |
Represents the style of a button.
enum dpp::component_type : uint8_t |
Represents the type of a component.
enum dpp::dave_version_t : uint8_t |
enum dpp::emoji_flags : uint8_t |
Flags for dpp::emoji.
enum dpp::entitlement_flags : uint8_t |
Entitlement flags.
enum dpp::entitlement_type : uint8_t |
The type of entitlement.
enum dpp::etf_token_type : uint8_t |
Represents a token which identifies the type of value which follows it in the ETF binary structure.
enum dpp::event_entity_type : uint8_t |
enum dpp::event_privacy_level : uint8_t |
enum dpp::event_status : uint8_t |
Exception error codes possible for dpp::exception::code()
This list is a combined list of Discord's error codes, HTTP error codes, zlib, opus and C library codes (e.g. DNS, socket etc). You may use these to easily identify a type of exception without having to resort to string comparison against dpp::exception::what()
For detailed descriptions of each error code, see the text description returned in what()
.
what()
. enum dpp::forum_layout_type : uint8_t |
enum dpp::guild_afk_timeout_t : uint8_t |
Voice AFK timeout values for guild::afk_timeout.
explicit content filter level. This is set by a guild admin, but can be forced to a setting if the server is verified, partnered, official etc.
enum dpp::guild_flags : uint32_t |
The various flags that represent the status of a dpp::guild object.
Enumerator | |
---|---|
g_large | Large guild. |
g_unavailable | Unavailable guild (inaccessible due to an outage) |
g_widget_enabled | Guild has widget enabled. |
g_invite_splash | Guild can have an invite splash image. |
g_vip_regions | Guild can have VIP regions. |
g_vanity_url | Guild can have a vanity url. |
g_verified | Guild is verified. |
g_partnered | Guild is partnered. |
g_community | Community features enabled. |
g_role_subscription_enabled | Guild has enabled role subscriptions. |
g_news | Guild has access to create announcement channels. |
g_discoverable | Guild is discoverable in discovery. |
g_featureable | Guild is featureable. |
g_animated_icon | Guild can have an animated icon (doesn't mean it actually has one though) |
g_banner | Guild can have a banner image. |
g_welcome_screen_enabled | Guild has a welcome screen. |
g_member_verification_gate | Guild has a member verification gate. |
g_preview_enabled | Guild has a preview. |
g_no_join_notifications | Guild join notifications are off. |
g_no_boost_notifications | Guild boost notifications are off. |
g_has_animated_icon | Guild has an actual animated icon (set by the icon hash starting with 'a_') |
g_has_animated_banner | Guild has an actual animated banner (set by the icon hash starting with 'a_') |
g_no_setup_tips | Guild setup tips are off. |
g_no_sticker_greeting | "Wave to say hi" sticker prompt buttons are off |
g_monetization_enabled | Guild has enabled monetization. |
g_more_stickers | Guild has increased custom sticker slots. |
g_creator_store_page_enabled | Guild has enabled the role subscription promo page. |
g_role_icons | Guild is able to set role icons. |
g_seven_day_thread_archive | Guild has access to the seven day archive time for threads.
|
g_three_day_thread_archive | Guild has access to the three day archive time for threads.
|
g_ticketed_events | Guild has enabled ticketed events. |
g_channel_banners | Guild can have channel banners.
|
enum dpp::guild_flags_extra : uint16_t |
Additional boolean flag values for guild, as guild_flags is full.
enum dpp::guild_member_flags : uint16_t |
Various flags that can be used to indicate the status of a guild member.
Enumerator | |
---|---|
gm_deaf | Member deafened in voice channel. |
gm_mute | Member muted in voice channels. |
gm_pending | Member pending verification by membership screening. |
gm_animated_avatar | Member has animated guild-specific avatar. |
gm_voice_action | gm_deaf or gm_mute has been toggled |
gm_did_rejoin | Member has left and rejoined the guild. |
gm_completed_onboarding | Member has completed onboarding. |
gm_bypasses_verification | Member is exempt from guild verification requirements. |
gm_started_onboarding | Member has started onboarding. |
gm_roles_action | Should change roles on next call to edit guild_member?
|
gm_nickname_action | Should nicknames on next call to edit guild_member?
|
enum dpp::guild_nsfw_level_t : uint8_t |
Guild NSFW level. Used to represent just how naughty this guild is. Naughty guild, go sit in the corner.
Enumerator | |
---|---|
nsfw_default | Default setting, not configured. |
nsfw_explicit | Explicit content may be in this guild. |
nsfw_safe | Safe for work content only. |
nsfw_age_restricted | Age restricted, 18+. |
enum dpp::guild_premium_tier_t : uint8_t |
enum dpp::http_error : uint8_t |
Error values. Most of these are currently unused in https_client.
enum dpp::http_method |
enum dpp::http_state : uint8_t |
HTTP connection status.
enum dpp::image_type : uint8_t |
enum dpp::integration_flags : uint8_t |
Integration flags.
enum dpp::integration_type : uint8_t |
enum dpp::intents |
intents are a bitmask of allowed events on your websocket.
Some of these are known as Privileged intents (GUILD_MEMBERS and GUILD_PRESENCES) and require verification of a bot over 100 servers by discord via submission of your real life ID.
Enumerator | |
---|---|
i_guilds | Intent for receipt of guild information. |
i_guild_members | Intent for receipt of guild members. |
i_guild_bans | Intent for receipt of guild bans. |
i_guild_emojis | Intent for receipt of guild emojis. |
i_guild_integrations | Intent for receipt of guild integrations. |
i_guild_webhooks | Intent for receipt of guild webhooks. |
i_guild_invites | Intent for receipt of guild invites. |
i_guild_voice_states | Intent for receipt of guild voice states. |
i_guild_presences | Intent for receipt of guild presences. |
i_guild_messages | Intent for receipt of guild messages. |
i_guild_message_reactions | Intent for receipt of guild message reactions. |
i_guild_message_typing | Intent for receipt of guild message typing notifications. |
i_direct_messages | Intent for receipt of direct messages (DMs). |
i_direct_message_reactions | Intent for receipt of direct message reactions. |
i_direct_message_typing | Intent for receipt of direct message typing notifications. |
i_message_content | Intent for receipt of message content. |
i_guild_scheduled_events | Scheduled events. |
i_auto_moderation_configuration | Auto moderation configuration. |
i_auto_moderation_execution | Auto moderation configuration. |
i_default_intents | Default D++ intents (all non-privileged intents). |
i_privileged_intents | Privileged intents requiring ID. |
i_all_intents | Every single intent (dpp::i_default_intents and dpp::i_privileged_intents). |
i_unverified_default_intents | Unverified bots default intents. |
Response types when responding to an interaction within on_interaction_create.
Enumerator | |
---|---|
ir_pong | Acknowledge a Ping. |
ir_channel_message_with_source | Respond to an interaction with a message. |
ir_deferred_channel_message_with_source | Acknowledge an interaction and edit a response later, the user sees a loading state. |
ir_deferred_update_message | For components, acknowledge an interaction and edit the original message later; the user does not see a loading state. |
ir_update_message | For components, edit the message the component was attached to. |
ir_autocomplete_reply | Reply to autocomplete interaction.
|
ir_modal_dialog | A modal dialog box.
|
ir_premium_required | Acknowledge a interaction with an upgrade button, only available for apps with monetization enabled.
@depreciated Replaced with buttons with a style of cos_premium This interaction type may stop working at any point |
Types of interaction in the dpp::interaction class
enum dpp::invite_target_t : uint8_t |
Invite target types for dpp::invite.
Enumerator | |
---|---|
itt_none | Undefined invite target type. |
itt_stream | Stream target type. |
itt_embedded_application | Embedded Application target type. |
enum dpp::loglevel |
enum dpp::media_loading_state : uint8_t |
enum dpp::message_flags : uint16_t |
Bitmask flags for a dpp::message.
enum dpp::message_type : uint8_t |
Message types for dpp::message::type.
enum dpp::mfa_level_t : uint8_t |
enum dpp::onboarding_mode : uint8_t |
The onboarding mode for the dpp::onboarding object. Defines the criteria used to satisfy Onboarding constraints that are required for enabling.
Enumerator | |
---|---|
gom_default | Counts only Default Channels towards constraints. |
gom_advanced | Counts Default Channels and Questions towards constraints. |
Various flags for dpp::onboarding_prompt.
The various types of dpp::onboarding_prompt.
Enumerator | |
---|---|
opt_multiple_choice | Multiple choice. |
opt_dropdown | Dropdown. |
enum dpp::overwrite_type : uint8_t |
enum dpp::parameter_type |
Parameter types when registering a command. We don't pass these in when triggering the command in the handler, because it is expected the developer added the command so they know what types to expect for each named parameter.
enum dpp::permissions : uint64_t |
Represents the various discord permissions.
enum dpp::presence_flags |
Presence flags bitmask.
enum dpp::presence_status : uint8_t |
enum dpp::region : uint8_t |
Represents voice regions for guilds and channels.
enum dpp::role_flags : uint8_t |
Various flags related to dpp::role.
enum dpp::separator_spacing : uint8_t |
enum dpp::shard_frame_type : int |
Represents different event opcodes sent and received on a shard websocket.
These are used internally to route frames.
enum dpp::sku_flags : uint16_t |
SKU flags.
enum dpp::sku_type : uint8_t |
The type of SKU.
enum dpp::socket_event_flags : uint8_t |
Types of IO events a socket may subscribe to.
enum dpp::socket_listener_type : uint8_t |
enum dpp::stage_privacy_level : uint8_t |
enum dpp::start_type : bool |
Types of startup for cluster::start()
Enumerator | |
---|---|
st_wait | Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will not return in normal operation. |
st_return | Return immediately after starting shard threads. If you set the parameter of cluster::start() to this value, you will have to manage the lifetime and scope of your cluster object yourself. Taking it out of scope or deleting its pointer will terminate the bot. |
enum dpp::sticker_format : uint8_t |
enum dpp::sticker_type : uint8_t |
enum dpp::team_member_role_t : uint8_t |
enum dpp::team_member_status : uint8_t |
enum dpp::text_style_type : uint8_t |
enum dpp::user_flags : uint32_t |
Various bitmask flags used to represent information about a dpp::user.
enum dpp::verification_level_t : uint8_t |
Discord voice websocket opcode types.
Bit mask flags relating to voice states.
enum dpp::webhook_type |
enum dpp::websocket_protocol_t : uint8_t |
enum dpp::ws_opcode : uint8_t |
enum dpp::ws_state : uint8_t |
Websocket connection status.
std::string DPP_EXPORT dpp::base64_encode | ( | unsigned char const * | buf, |
unsigned int | buffer_length | ||
) |
Base64 encode data into a string.
buf | Raw binary buffer |
buffer_length | Buffer length to encode |
bool DPP_EXPORT dpp::bool_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a boolean value from a json field value, if defined, else returns false.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
DPP_EXPORT bool dpp::close_socket | ( | dpp::socket | sfd | ) |
Close a socket.
sfd | Socket to close |
std::string dpp::comma | ( | T | value | ) |
Add commas to a string (or dots) based on current locale server-side.
T | type of numeric value |
value | Value |
DPP_EXPORT std::unique_ptr<socket_engine_base> dpp::create_socket_engine | ( | class cluster * | creator | ) |
This is implemented by whatever derived form socket_engine takes.
creator | Creating cluster |
double DPP_EXPORT dpp::double_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a double from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
dpp::DPP_CHECK_ABI_COMPAT | ( | async<> | , |
async_dummy | |||
) |
dpp::DPP_CHECK_ABI_COMPAT | ( | coroutine< void > | , |
coroutine_dummy | |||
) |
dpp::DPP_CHECK_ABI_COMPAT | ( | task< void > | , |
task_dummy | |||
) |
class DPP_EXPORT dpp::DPP_DEPRECATED | ( | "commandhandler should not be used. Please consider using dpp::cluster::register_command instead." | ) |
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions.
It can automatically register slash commands, and handle routing of messages and interactions to separated command handler functions.
List of guild commands to bulk register
List of global commands to bulk register
Commands in the handler
Valid prefixes
Set to true automatically if one of the prefixes added is "/"
Cluster we are attached to for issuing REST calls
Application ID
Interaction event handle
Message event handle
Returns true if the string has a known prefix on the start. Modifies string to remove prefix if it returns true.
str | String to check and modify |
Construct a new commandhandler object
o | Owning cluster to attach to |
auto_hook_events | Set to true to automatically hook the on_slashcommand and on_message events. You should not need to set this to false unless you have a specific use case, as D++ supports multiple listeners to an event, so will allow the commandhandler to hook to your command events without disrupting other uses for the events you may have. |
application_id | The application id of the bot. If not specified, the class will look within the cluster object and use cluster::me::id instead. |
Destroy the commandhandler object
Set the application id after construction
o | Owning cluster to attach to |
Add a prefix to the command handler
prefix | Prefix to be handled by the command handler |
Add a command to the command handler
command | Command to be handled. Note that if any one of your prefixes is "/" this will attempt to register a global command using the API and you will receive notification of this command via an interaction event. |
handler | Handler function |
parameters | Parameters to use for the command |
description | The description of the command, shown for slash commands |
guild_id | The guild ID to restrict the command to. For slash commands causes registration of a guild command as opposed to a global command. |
dpp::logic_exception | if application ID cannot be determined |
Register all slash commands with Discord This method must be called at least once if you are using the "/" prefix to mark the end of commands being added to the handler. Note that this uses bulk registration and will replace any existing slash commands.
Note that if you have previously registered your commands and they have not changed, you do not need to call this again. Discord retains a cache of previously added commands.
Route a command from the on_message_create function. Call this method from within your on_message_create with the received dpp::message object if you have disabled automatic registration of events.
event | message create event to parse |
Route a command from the on_slashcommand function. Call this method from your on_slashcommand with the received dpp::interaction_create_t object if you have disabled automatic registration of events.
event | command interaction event to parse |
Reply to a command. You should use this method rather than cluster::message_create as the way you reply varies between slash commands and message commands. Note you should ALWAYS reply. Slash commands will emit an ugly error to the user if you do not emit some form of reply within 3 seconds.
m | message to reply with. |
source | source of the command |
callback | User function to execute when the api call completes. |
Reply to a command without a message, causing the discord client to display "Bot name is thinking...". The "thinking" message will persist for a maximum of 15 minutes. This counts as a reply for a slash command. Slash commands will emit an ugly error to the user if you do not emit some form of reply within 3 seconds.
source | source of the command |
callback | User function to execute when the api call completes. |
Easter egg (redefinition of dpp::commandhandler::thinking).
Find an object in the cache by id.
Find an object in the cache by id.
Find an object in the cache by id.
guild_member DPP_EXPORT dpp::find_guild_member | ( | const snowflake | guild_id, |
const snowflake | user_id | ||
) |
Get the guild_member from cache of given IDs.
guild_id | ID of the guild to find guild_member for |
user_id | ID of the user to find guild_member for |
dpp::cache_exception | if the guild or guild_member is not found in the cache |
Find an object in the cache by id.
Find an object in the cache by id.
void DPP_EXPORT dpp::for_each_json | ( | nlohmann::json * | parent, |
std::string_view | key, | ||
const std::function< void(nlohmann::json *)> & | fn | ||
) |
Applies a function to each element of a json array.
parent | nlohmann::json instance to retrieve value from |
key | key name to check for the values |
fn | function to apply to each element |
void dpp::from_json | ( | const nlohmann::json & | j, |
autocomplete_interaction & | ai | ||
) |
helper function to deserialize an autocomplete_interaction from json
j | output json object |
ai | autocomplete_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
command_data_option & | cdo | ||
) |
helper function to deserialize a command_data_option from json
j | output json object |
cdo | command_data_option to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
command_interaction & | ci | ||
) |
helper function to deserialize a command_interaction from json
j | output json object |
ci | command_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
component_interaction & | bi | ||
) |
helper function to deserialize a component_interaction from json
j | output json object |
bi | button_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
guild_member & | gm | ||
) |
helper function to deserialize a guild_member from json
j | output json object |
gm | guild_member to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
interaction & | i | ||
) |
helper function to deserialize an interaction from json
j | output json object |
i | interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
user & | u | ||
) |
helper function to deserialize a user from json
j | output json object |
u | user to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
user_identified & | u | ||
) |
helper function to deserialize a user_identified from json
j | output json object |
u | user to be deserialized |
T dpp::from_string | ( | const std::string & | s | ) |
Convert any value from a string to another type using stringstream.
T | Type to convert to |
s | String to convert from |
uint64_t dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of uint64_t from string.
int64_t |
s | string to convert |
uint32_t dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of uint32_t from string.
uint32_t |
s | string to convert |
int dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of int from string.
int |
s | string to convert |
T dpp::from_string | ( | const std::string & | s, |
std::ios_base &(*)(std::ios_base &) | f | ||
) |
Convert any value from a string to another type using stringstream. The optional second parameter indicates the format of the input string, e.g. std::dec for decimal, std::hex for hex, std::oct for octal.
T | Type to convert to |
s | String to convert from |
f | Numeric base, e.g. std::dec or std::hex |
void DPP_EXPORT dpp::garbage_collection | ( | ) |
Run garbage collection across all caches removing deleted items that have been deleted over 60 seconds ago.
DPP_EXPORT uint64_t dpp::get_channel_count | ( | ) |
Get the amount of cached channel objects.
DPP_EXPORT uint64_t dpp::get_emoji_count | ( | ) |
Get the amount of cached emoji objects.
DPP_EXPORT uint64_t dpp::get_guild_count | ( | ) |
Get the amount of cached guild objects.
DPP_EXPORT uint64_t dpp::get_role_count | ( | ) |
Get the amount of cached role objects.
DPP_EXPORT uint64_t dpp::get_user_count | ( | ) |
Get the amount of cached user objects.
uint16_t DPP_EXPORT dpp::int16_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint32_t DPP_EXPORT dpp::int32_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint64_t DPP_EXPORT dpp::int64_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. DO NOT use this for snowflakes, as usually snowflakes are wrapped in a string!
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint8_t DPP_EXPORT dpp::int8_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string dpp::leading_zeroes | ( | T | i, |
size_t | width | ||
) |
Format a numeric type as a string with leading zeroes.
T | numeric type |
i | numeric value |
width | width of type including the leading zeroes |
std::basic_string<T> dpp::lowercase | ( | const std::basic_string< T > & | s | ) |
Convert a string to lowercase using tolower()
T | type of string |
s | String to lowercase |
|
inline |
trim from beginning of string (left)
s | string to trim |
const DPP_EXPORT dns_cache_entry* dpp::resolve_hostname | ( | const std::string & | hostname, |
const std::string & | port | ||
) |
Resolve a hostname to an addrinfo.
hostname | Hostname to resolve |
port | A port number or named service, e.g. "80" |
dpp::connection_exception | On failure to resolve hostname |
|
inline |
Templated REST request helper to save on typing.
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (specialised for confirmation)
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (specialised for message)
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
root | Root element to look for |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists, specialised for bans)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists, specialised for invites)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists, specialised for sticker packs)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists, specialised for voiceregions)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists, specialised for objects which doesn't have ids)
T | singular type to return in lambda callback |
T | vector type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
trim from end of string (right)
s | String to trim |
auto dpp::run_once | ( | ) |
Run some code within an if() statement only once.
Use this template like this:
if (dpp::run_once<struct any_unique_name_you_like_here>()) { // Your code here }
T | any unique 'tag' identifier name |
void DPP_EXPORT dpp::set_bool_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
bool & | v | ||
) |
Sets a boolean from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_double_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
double & | v | ||
) |
Sets a double from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_iconhash_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
utility::iconhash & | v | ||
) |
This is a repeat of set_string_not_null, but takes in a iconhash.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int16_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint16_t & | v | ||
) |
Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int32_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint32_t & | v | ||
) |
Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int64_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint64_t & | v | ||
) |
Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int8_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint8_t & | v | ||
) |
Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
DPP_EXPORT bool dpp::set_nonblocking | ( | dpp::socket | sockfd, |
bool | non_blocking | ||
) |
Set a socket to blocking or non-blocking IO.
sockfd | socket to act upon |
non_blocking | should socket be non-blocking? |
void dpp::set_object_array_not_null | ( | nlohmann::json * | j, |
std::string_view | key, | ||
std::vector< T > & | v | ||
) |
Sets an array of objects from a json field value, if defined, else does nothing.
T | The class of which the array consists of. Must be derived from dpp::json_interface |
j | nlohmann::json instance to retrieve value from |
key | key name to check for the values |
v | Value to change |
void dpp::set_signal_handler | ( | int | signal | ) |
Set up a signal handler to be ignored.
signal | Signal to set. If the signal is already set up with a handler, this will do nothing. |
void DPP_EXPORT dpp::set_snowflake_array_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
std::vector< class snowflake > & | v | ||
) |
Sets an array of snowflakes from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for the values |
v | Value to change |
void DPP_EXPORT dpp::set_snowflake_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint64_t & | v | ||
) |
Sets a snowflake id from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_string_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
std::string & | v | ||
) |
Sets a string from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_ts_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
time_t & | v | ||
) |
Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
uint64_t DPP_EXPORT dpp::snowflake_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a snowflake id from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string DPP_EXPORT dpp::string_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a string from a json field value, if defined, else returns an empty string.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string dpp::to_hex | ( | T | i, |
bool | leading_zeroes = true |
||
) |
Convert a numeric value to hex.
T | numeric type |
i | numeric value |
leading_zeroes | set to false if you don't want the leading zeroes in the output |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_option & | opt | ||
) |
helper function to serialize a command_option to json
j | output json object |
opt | command_option to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_option_choice & | choice | ||
) |
helper function to serialize a command_option_choice to json
j | output json object |
choice | command_option_choice to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_permission & | cp | ||
) |
helper function to serialize a command_permission to json
j | output json object |
cp | command_permission to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const guild_command_permissions & | gcp | ||
) |
helper function to serialize a guild_command_permissions to json
j | output json object |
gcp | guild_command_permissions to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const permission_overwrite & | po | ||
) |
Serialize a permission_overwrite object to json.
j | JSON object to serialize to |
po | object to serialize |
void dpp::to_json | ( | nlohmann::json & | j, |
const slashcommand & | cmd | ||
) |
helper function to serialize a slashcommand to json
j | output json object |
cmd | slashcommand to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const thread_metadata & | tmdata | ||
) |
Serialize a thread_metadata object to json.
j | JSON object to serialize to |
tmdata | object to serialize |
|
inline |
Trim from both ends of string (right then left)
s | string to trim |
time_t DPP_EXPORT dpp::ts_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns epoch value of 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string DPP_EXPORT dpp::ts_to_string | ( | time_t | ts | ) |
Convert time_t unix epoch to std::string ISO date/time.
ts | Timestamp to convert |
std::basic_string<T> dpp::uppercase | ( | const std::basic_string< T > & | s | ) |
Convert a string to uppercase using toupper()
T | type of string |
s | String to uppercase |
bool dpp::validate_configuration | ( | ) |
dpp::when_any | ( | Args... | ) | -> when_any< detail::when_any::awaitable_type< Args >... > |
concept dpp::awaitable_type = requires (T expr) { detail::co_await_resolve(expr).await_ready(); } |
Concept to check if a type can be used with co_await.
|
constexpr |
Size of decompression buffer for zlib compressed traffic.
DPP_EXPORT std::mutex dpp::deletion_mutex |
DPP_EXPORT std::unordered_map<managed*, time_t> dpp::deletion_queue |
|
inlinestaticconstexpr |
|
constexpr |
SSL_read buffer size.
You'd think that we would get better performance with a bigger buffer, but SSL frames are 16k each. SSL_read in non-blocking mode will only read 16k at a time. There's no point in a bigger buffer as it'd go unused.
|
constexpr |
Represents a failed socket system call, e.g. connect() failure.
const uint8_t dpp::FORMAT_VERSION = 131 |
Current ETF format version in use.
|
inlinestatic |
= "DiscordBot (https://github.com/brainboxdotcc/DPP, " + to_hex(DPP_VERSION_MAJOR, false) + "." + to_hex(DPP_VERSION_MINOR, false) + "." + to_hex(DPP_VERSION_PATCH, false) + ")"
|
inline |
Version checking, making sure the program is in a configuration compatible with DPP's.
Do NOT make these variables constexpr. We want them to initialize at runtime so the function can be pulled from the shared library object.
|
constexpr |
|
constexpr |
Maximum number of internal connect() retries on TCP connections.
enum DPP_EXPORT dpp::message_ref_type |
Message Reference type.
enum DPP_EXPORT dpp::mrt_forward = 1 |
A forwarded message
|
constexpr |
Pass this value into the constructor of dpp::cluster for the shard count to create a cluster with no shards. A cluster with no shards does not connect to a websocket, but can still use the event loop to dispatch HTTPS API requests to Discord. This is useful for bots that do not need to receive websocket events as it will save a lot of resources.
|
inlineconstexpr |
Channel count for OPUS (stereo)
|
inlineconstexpr |
Sample rate for OPUS (48khz)
|
constexpr |
How many seconds to wait between (re)connections. DO NOT change this. It is mandated by the Discord API spec!
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Discord voice protocol version.