The main namespace for D++ functions. More...
Namespaces | |
anonymous_namespace{confirmation.cpp} | |
anonymous_namespace{queues.cpp} | |
cache_policy | |
Contains a set of predefined cache policies for use when constructing a dpp::cluster. | |
colors | |
predefined color constants. | |
detail | |
Implementation details for internal use only. | |
embed_type | |
Represents possible values for the dpp::embed type field. | |
events | |
The events namespace holds the internal event handlers for each websocket 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. 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. 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 | 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. 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. 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 | ban |
The ban class represents a ban on a guild. More... | |
struct | bucket_t |
A rate limit bucket. 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. More... | |
class | channel_collector |
Channel collector. 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. More... | |
class | collected_reaction |
Represents a reaction. More... | |
class | collector |
Collects objects from events during a specified time period. More... | |
struct | command_data_option |
Values in the command interaction. 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. More... | |
struct | command_option |
Each command option is a command line parameter. More... | |
struct | command_option_choice |
This struct represents choices in a multiple choice option for a command parameter. 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. More... | |
struct | command_source |
Represents the sending source of a command. More... | |
class | commandhandler |
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions. More... | |
class | component |
Represents the component object. 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. More... | |
class | coroutine |
Base type for a coroutine, starts on co_await. More... | |
struct | coroutine_dummy |
class | discord_client |
Implements a discord client. More... | |
class | discord_voice_client |
Implements a discord voice connection. More... | |
struct | dns_cache_entry |
Represents a cached DNS result. 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. More... | |
struct | embed_provider |
Embed provider in a dpp::embed. 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. 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. 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. 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. More... | |
class | https_client |
Implements a HTTPS socket client based on the SSL client. More... | |
class | in_thread |
Represents a thread in the thread pool handling requests to HTTP(S) servers. More... | |
class | integration |
Represents an integration on a guild, e.g. More... | |
struct | integration_account |
The account information for an integration. More... | |
struct | integration_app |
An application that has been integrated. 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. More... | |
struct | interaction_create_t |
Create interaction. 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. More... | |
struct | keepalive_cache_t |
Keepalive cache record. 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. 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. 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_update_t |
Message update. 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. More... | |
class | openssl_connection |
This is an opaque class containing openssl library specific structures. More... | |
class | openssl_context_deleter |
Custom deleter for SSL_CTX. More... | |
struct | param_info |
Details of a command parameter used in registration. 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. More... | |
struct | presence_update_t |
Presence update. More... | |
struct | prune |
Defines a request to count prunable users, or start a prune operation. More... | |
struct | reaction |
Represents a reaction to a dpp::message. More... | |
class | reaction_collector |
Reaction collector. More... | |
struct | ready_t |
Session ready. 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. More... | |
class | rest_exception |
Represents an error on a REST API call, e.g. More... | |
struct | resumed_t |
Session resumed. More... | |
class | role |
Represents a role within a dpp::guild. More... | |
class | role_collector |
Role collector. More... | |
struct | rtp_header |
Represents an RTP packet. More... | |
struct | scheduled_event |
A scheduled event. More... | |
class | scheduled_event_collector |
Scheduled event collector. More... | |
struct | select_click_t |
Click on select. More... | |
struct | select_option |
An option for a select component. 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. More... | |
class | ssl_client |
Implements a simple non-blocking SSL stream client. More... | |
struct | stage_instance |
A stage instance. 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. 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. More... | |
class | thread_collector |
Thread collector. 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_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. 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. 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. 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_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 user talking 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... | |
struct | voice_user_talking_t |
voice user talking More... | |
class | voiceconn |
Represents a connection to a voice channel. 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. More... | |
Typedefs | |
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. More... | |
typedef std::unordered_map< snowflake, application > | application_map |
A group of applications. 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, automod_rule > | automod_rule_map |
A group of automod rules. More... | |
typedef std::unordered_map< snowflake, ban > | ban_map |
A group of bans. More... | |
typedef dpp::collector< dpp::channel_create_t, dpp::channel > | channel_collector_t |
Template type for base class of channel collector. More... | |
typedef std::unordered_map< snowflake, channel > | channel_map |
A group of channels. 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... | |
typedef std::function< void(const std::string &, const parameter_list_t &, command_source)> | command_handler |
The function definition for a command handler. 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. 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. More... | |
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. More... | |
using | component_emoji = partial_emoji |
An emoji for a component. 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, 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::unordered_map< snowflake, connection > | connection_map |
A group of connections. More... | |
using | dns_cache_t = std::unordered_map< std::string, 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, event_member > | event_member_map |
A group of scheduled event members. 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, guild > | guild_map |
A container of guilds. More... | |
typedef std::unordered_map< snowflake, guild_member > | guild_member_map |
A container of guild members. 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::multimap< std::string, std::string > | http_headers |
Request headers. More... | |
typedef std::unordered_map< snowflake, integration > | integration_map |
A group of integrations. More... | |
typedef std::unordered_map< std::string, invite > | invite_map |
A container of invites. More... | |
using | json = nlohmann::json |
typedef std::function< void(json &, const http_request_completion_t &)> | json_encode_t |
Automatically JSON encoded HTTP result. More... | |
typedef std::unordered_map< snowflake, guild_member > | members_container |
Guild members container. More... | |
typedef dpp::collector< dpp::message_create_t, dpp::message > | message_collector_t |
Template type for base class of message collector. More... | |
typedef std::unordered_map< snowflake, message > | message_map |
A group of messages. More... | |
typedef std::vector< std::pair< std::string, command_parameter > > | parameter_list_t |
Parameter list for a called command. More... | |
typedef std::vector< std::pair< std::string, param_info > > | parameter_registration_t |
Parameter list used during registration. More... | |
typedef std::unordered_map< snowflake, presence > | presence_map |
A container of presences. 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 dpp::collector< dpp::guild_role_create_t, dpp::role > | role_collector_t |
Template type for base class of role collector. More... | |
typedef std::unordered_map< snowflake, role > | role_map |
A group of roles. More... | |
using | role_permissions = permissions |
Represents the various discord permissions. 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 std::unordered_map< snowflake, scheduled_event > | scheduled_event_map |
A group of scheduled events. More... | |
typedef std::map< uint32_t, class discord_client * > | shard_list |
A list of shards. More... | |
typedef std::unordered_map< snowflake, sku > | sku_map |
Group of SKUs. More... | |
typedef std::unordered_map< snowflake, slashcommand > | slashcommand_map |
A group of application slash commands. More... | |
typedef int | socket |
Represents a socket file descriptor. More... | |
typedef std::function< dpp::socket()> | socket_callback_t |
A callback for socket status. More... | |
typedef std::function< void()> | socket_notification_t |
A socket notification callback. More... | |
typedef std::unordered_map< snowflake, stage_instance > | stage_instance_map |
A group of stage instances. 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... | |
typedef dpp::collector< dpp::thread_create_t, dpp::thread > | thread_collector_t |
Template type for base class of thread collector. More... | |
typedef std::unordered_map< snowflake, thread > | thread_map |
A group of threads. More... | |
typedef std::unordered_map< snowflake, thread_member > | thread_member_map |
A group of thread member objects. More... | |
typedef size_t | timer |
Represents a timer handle. More... | |
typedef std::function< void(timer)> | timer_callback_t |
The type for a timer callback. More... | |
typedef std::multimap< time_t, timer_t * > | timer_next_t |
A map of timers, ordered by earliest first so that map::begin() is always the soonest to be due. More... | |
typedef std::unordered_map< timer, timer_t * > | timer_reg_t |
A map of timers stored by handle. 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 |
A container of voicestates. More... | |
typedef std::unordered_map< snowflake, webhook > | webhook_map |
A group of webhooks. More... | |
Functions | |
std::string DPP_EXPORT | base64_encode (unsigned char const *buf, unsigned int buffer_length) |
Base64 encode data into a string. 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... | |
bool | close_socket (dpp::socket sfd) |
Close a socket. More... | |
template<class T > | |
std::string | comma (T value) |
Add commas to a string (or dots) based on current locale server-side. More... | |
int | connect_with_timeout (dpp::socket sockfd, const struct sockaddr *addr, socklen_t addrlen, unsigned int timeout_ms) |
Connect to TCP socket with a poll() driven timeout. 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... | |
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 > | |
json | error_response (const std::string &message, http_request_completion_t &rv) |
Given an error exception from nlohmann::json, turn it into a discord-style error object that can be parsed by the get_error() function. More... | |
DPP_EXPORT class channel * | find_channel (snowflake id) |
Find an object in the cache by id. More... | |
DPP_EXPORT class emoji * | find_emoji (snowflake id) |
Find an object in the cache by id. More... | |
DPP_EXPORT class guild * | find_guild (snowflake id) |
Find an object in the cache by id. 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... | |
DPP_EXPORT class role * | find_role (snowflake id) |
Find an object in the cache by id. More... | |
DPP_EXPORT class user * | find_user (snowflake id) |
Find an object in the cache by id. 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... | |
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, 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, guild_member &gm) |
helper function to deserialize a guild_member from json More... | |
void | from_json (const nlohmann::json &j, interaction &i) |
helper function to deserialize an interaction from json More... | |
void | from_json (const nlohmann::json &j, poll &p) |
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... | |
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 > | |
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. More... | |
void DPP_EXPORT | garbage_collection () |
Run garbage collection across all caches removing deleted items that have been deleted over 60 seconds ago. More... | |
DPP_EXPORT cache< class channel > * | get_channel_cache () |
DPP_EXPORT uint64_t | get_channel_count () |
Get the amount of cached channel objects. More... | |
DPP_EXPORT cache< class emoji > * | get_emoji_cache () |
DPP_EXPORT uint64_t | get_emoji_count () |
Get the amount of cached emoji objects. More... | |
DPP_EXPORT cache< class guild > * | get_guild_cache () |
DPP_EXPORT uint64_t | get_guild_count () |
Get the amount of cached guild objects. More... | |
DPP_EXPORT cache< class role > * | get_role_cache () |
DPP_EXPORT uint64_t | get_role_count () |
Get the amount of cached role objects. More... | |
DPP_EXPORT cache< class user > * | get_user_cache () |
DPP_EXPORT uint64_t | get_user_count () |
Get the amount of cached user objects. More... | |
uint32_t | hash (const char *s) |
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... | |
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... | |
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. 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... | |
template<typename T > | |
std::string | leading_zeroes (T i, size_t width) |
Format a numeric type as a string with leading zeroes. More... | |
template<typename T > | |
std::basic_string< T > | lowercase (const std::basic_string< T > &s) |
Convert a string to lowercase using tolower() More... | |
std::string | ltrim (std::string s) |
trim from beginning of string (left) More... | |
template<typename T > | |
std::function< void(const T &)> | make_intent_warning (cluster *cl, const intents required_intent, const std::string &message) |
Make a warning lambda for missing message intents. More... | |
template<typename EventType > | |
static dpp::events::event * | make_static_event () noexcept |
void | populate_result (const std::string &url, cluster *owner, http_request_completion_t &rv, const https_client &res) |
const dns_cache_entry * | resolve_hostname (const std::string &hostname, const std::string &port) |
Resolve a hostname to an addrinfo. 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< 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<> | |
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<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_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< 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< 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< 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<> | |
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<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... | |
std::string | rtrim (std::string s) |
trim from end of string (right) More... | |
template<typename T > | |
auto | run_once () |
Run some code within an if() statement only once. 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... | |
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... | |
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... | |
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... | |
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... | |
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... | |
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 | set_nonblocking (dpp::socket sockfd, bool non_blocking) |
Set a socket to blocking or non-blocking IO. 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... | |
void | set_signal_handler (int signal) |
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 | 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_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_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... | |
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... | |
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... | |
template<typename T , class F , class... Ts> | |
T | sync (class cluster *c, F func, Ts &&... args) |
Call a D++ REST function synchronously. More... | |
template<typename T > | |
std::string | to_hex (T i, bool leading_zeroes=true) |
Convert a numeric value to hex. More... | |
void | to_json (json &j, const attachment &a) |
void | to_json (json &j, const component &cp) |
void | to_json (json &j, const poll &p) |
void | to_json (nlohmann::json &j, const command_option &opt) |
helper function to serialize a command_option to json More... | |
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_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 permission_overwrite &po) |
Serialize a permission_overwrite object to json. More... | |
void | to_json (nlohmann::json &j, const slashcommand &cmd) |
helper function to serialize a slashcommand to json More... | |
void | to_json (nlohmann::json &j, const thread_metadata &tmdata) |
Serialize a thread_metadata object to json. More... | |
std::string | trim (std::string s) |
Trim from both ends of string (right then left) 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... | |
std::string DPP_EXPORT | ts_to_string (time_t ts) |
Convert time_t unix epoch to std::string ISO date/time. More... | |
template<typename T > | |
std::basic_string< T > | uppercase (const std::basic_string< T > &s) |
Convert a string to uppercase using toupper() More... | |
template<build_type > | |
bool | validate_configuration () |
template bool DPP_EXPORT | validate_configuration< build_type::debug > () |
template bool DPP_EXPORT | validate_configuration< build_type::release > () |
template bool DPP_EXPORT | validate_configuration< build_type::universal > () |
template<typename... Args> | |
when_any (Args...) -> when_any< detail::when_any::awaitable_type< Args >... > | |
Variables | |
thread_local std::string | audit_reason |
An audit reason for each thread. More... | |
cache< channel > * | channel_cache = nullptr |
const uint16_t | DEFAULT_FORUM_LAYOUT_MASK = 0b0000011000000000 |
DPP_EXPORT std::mutex | deletion_mutex |
DPP_EXPORT std::unordered_map< managed *, time_t > | deletion_queue |
static constexpr const char * | DISCORD_HOST = "https://discord.com" |
dns_cache_t | dns_cache |
std::shared_mutex | dns_cache_mutex |
cache< emoji > * | emoji_cache = nullptr |
const int | ERROR_STATUS = -1 |
static const std::map< std::string, dpp::events::event * > | event_map |
std::string | external_ip |
const std::map< std::string, std::variant< dpp::guild_flags, dpp::guild_flags_extra > > | featuremap |
const uint8_t | FORMAT_VERSION = 131 |
Current ETF format version in use. More... | |
cache< guild > * | guild_cache = nullptr |
static const std::string | http_version |
const bool | is_valid_config = validate_configuration<build_type::universal>() |
Version checking, making sure the program is in a configuration compatible with DPP's. More... | |
thread_local std::unordered_map< std::string, keepalive_cache_t > | keepalives |
Keepalive sessions, per-thread. More... | |
static thread_local std::string | last_ping_message |
Stores the most recent ping message on this shard, which we check for to monitor latency. More... | |
timer | lasthandle = 1 |
const size_t | MAX_ICON_SIZE = 256 * 1024 |
constexpr size_t | MAXHEADERSIZE = sizeof(uint64_t) + 2 |
std::map< uint16_t, dpp::guild_member_flags > | membermap |
constexpr time_t | one_hour = 60 * 60 |
thread_local std::unique_ptr< SSL_CTX, openssl_context_deleter > | openssl_context |
OpenSSL context. More... | |
constexpr int32_t | opus_channel_count = 2 |
constexpr int32_t | opus_sample_rate_hz = 48000 |
cache< role > * | role_cache = nullptr |
std::map< uint8_t, dpp::role_flags > | rolemap |
constexpr size_t | send_audio_raw_max_length = 11520 |
std::mutex | timer_guard |
cache< user > * | user_cache = nullptr |
std::map< uint32_t, dpp::user_flags > | usermap |
constexpr unsigned char | WS_FINBIT = (1u << 7u) |
constexpr unsigned char | WS_MASKBIT = (1u << 7u) |
constexpr size_t | WS_MAX_PAYLOAD_LENGTH_LARGE = 65535 |
constexpr size_t | WS_MAX_PAYLOAD_LENGTH_SMALL = 125 |
constexpr unsigned char | WS_PAYLOAD_LENGTH_MAGIC_HUGE = 127 |
constexpr unsigned char | WS_PAYLOAD_LENGTH_MAGIC_LARGE = 126 |
The main namespace for D++ functions.
The main namespace for D++ functions, classes and types.
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, 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.
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.
typedef dpp::collector<dpp::message_reaction_add_t, dpp::collected_reaction> dpp::reaction_collector_t |
Template type for base class of message reaction collector.
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.
typedef int dpp::socket |
Represents a socket file descriptor.
This is used to ensure parity between windows and unix-like systems.
typedef std::function<dpp::socket()> dpp::socket_callback_t |
A callback for socket status.
typedef std::function<void()> dpp::socket_notification_t |
A socket notification callback.
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::multimap<time_t, timer_t*> dpp::timer_next_t |
A map of timers, ordered by earliest first so that map::begin() is always the soonest to be due.
typedef std::unordered_map<timer, timer_t*> dpp::timer_reg_t |
A map of timers stored by handle.
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.
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.
enum dpp::application_role_connection_metadata_type : uint8_t |
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.
enum dpp::auto_archive_duration_t : uint8_t |
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
Existing group dms with bots will continue to function, but newly created channels will be unusable. |
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::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. |
enum dpp::component_default_value_type : uint8_t |
Represents the type of a dpp::component_default_value.
Enumerator | |
---|---|
cdt_user | |
cdt_role | |
cdt_channel |
enum dpp::component_style : uint8_t |
enum dpp::component_type : uint8_t |
Represents the type of a component.
enum dpp::default_forum_sort_order_t : uint8_t |
enum dpp::default_message_notification_t : uint8_t |
enum dpp::emoji_flags : uint8_t |
Flags for dpp::emoji.
enum dpp::entitlement_flags : uint16_t |
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, sodium 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.
enum dpp::guild_explicit_content_t : uint8_t |
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 |
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 |
Integration flags.
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.
|
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::message_flags : uint16_t |
Bitmask flags for a dpp::message.
enum dpp::message_type |
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. |
enum dpp::onboarding_prompt_flags : uint8_t |
Various flags for dpp::onboarding_prompt.
enum dpp::onboarding_prompt_type : uint8_t |
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::sku_flags : uint16_t |
SKU flags.
enum dpp::sku_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 |
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::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 |
Referenced by dpp::utility::image_data::base64_encode(), and main().
bool 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 |
Referenced by dpp::command_option::add_channel_type(), dpp::invite::fill_from_json_impl(), and from_json().
bool dpp::close_socket | ( | dpp::socket | sfd | ) |
Close a socket.
sfd | Socket to close |
References INVALID_SOCKET.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::connect(), dpp::discord_voice_client::discover_ip(), dpp::discord_client::one_second_timer(), and dpp::ssl_client::ssl_client().
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 |
int dpp::connect_with_timeout | ( | dpp::socket | sockfd, |
const struct sockaddr * | addr, | ||
socklen_t | addrlen, | ||
unsigned int | timeout_ms | ||
) |
Connect to TCP socket with a poll() driven timeout.
sockfd | socket descriptor |
addr | address to connect to |
addrlen | address length |
timeout_ms | timeout in milliseconds |
dpp::connection_exception | on failure |
References err_connect_failure, err_connection_timed_out, err_nonblocking_failure, set_nonblocking(), and dpp::utility::time_f().
Referenced by dpp::ssl_client::connect().
double 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 | |||
) |
json dpp::error_response | ( | const std::string & | message, |
http_request_completion_t & | rv | ||
) |
Given an error exception from nlohmann::json, turn it into a discord-style error object that can be parsed by the get_error() function.
Modifies the http request body, moving it to .get_error().errors[0].reason
in the callback.
message | Exception message |
rv | Request completion data |
Find an object in the cache by id.
Referenced by dpp::interaction::get_resolved_permission(), and dpp::commandhandler::route().
Find an object in the cache by id.
Find an object in the cache by id.
Referenced by dpp::interaction::get_resolved_attachment(), dpp::guild_member::get_user(), dpp::commandhandler::route(), and dpp::role::set_flags().
guild_member 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 |
Referenced by event_handler_test().
Find an object in the cache by id.
Referenced by dpp::commandhandler::route(), and dpp::guild_widget::to_json_impl().
Find an object in the cache by id.
Referenced by dpp::commandhandler::route(), and dpp::guild::set_splash().
void 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 |
References dpp::unicode_emoji::key.
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 |
References dpp::json_interface< T >::fill_from_json().
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 |
Referenced by dpp::user_identified::fill_from_json_impl().
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, |
poll & | p | ||
) |
References bool_not_null(), dpp::unicode_emoji::id, and int32_not_null().
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::garbage_collection | ( | ) |
Run garbage collection across all caches removing deleted items that have been deleted over 60 seconds ago.
Referenced by dpp::discord_client::one_second_timer().
uint64_t dpp::get_channel_count | ( | ) |
Get the amount of cached channel objects.
uint64_t dpp::get_emoji_count | ( | ) |
Get the amount of cached emoji objects.
Referenced by dpp::discord_client::get_channel_count(), dpp::discord_client::get_guild_count(), and dpp::discord_client::get_member_count().
uint64_t dpp::get_guild_count | ( | ) |
Get the amount of cached guild objects.
Referenced by main().
uint64_t dpp::get_role_count | ( | ) |
Get the amount of cached role objects.
uint64_t dpp::get_user_count | ( | ) |
Get the amount of cached user objects.
Referenced by main().
|
inline |
Referenced by dpp::utility::iconhash::iconhash(), dpp::utility::icon::operator=(), and dpp::utility::iconhash::set().
uint16_t 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::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 |
Referenced by dpp::invite::fill_from_json_impl(), from_json(), dpp::message::message(), and dpp::embed_footer::set_icon().
uint64_t 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::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 |
Referenced by dpp::command_option::add_channel_type(), and dpp::invite::fill_from_json_impl().
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 |
Referenced by dpp::commandhandler::route(), dpp::commandhandler::string_has_prefix(), dpp::slashcommand::to_json_impl(), and dpp::commandhandler::~commandhandler().
|
inline |
trim from beginning of string (left)
s | string to trim |
std::function<void(const T&)> dpp::make_intent_warning | ( | cluster * | cl, |
const intents | required_intent, | ||
const std::string & | message | ||
) |
Make a warning lambda for missing message intents.
T | type of parameter for the event in the router |
cl | Creating cluster |
required_intent | Intent which is required |
message | Message to display |
|
staticnoexcept |
void dpp::populate_result | ( | const std::string & | url, |
cluster * | owner, | ||
http_request_completion_t & | rv, | ||
const https_client & | res | ||
) |
const 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 |
The -20 makes sure the error codes dont conflict with codes given in the rest of the list Because C libraries love to use -1 and below directly as conflicting error codes.
The -20 makes sure the error codes dont conflict with codes given in the rest of the list Because C libraries love to use -1 and below directly as conflicting error codes.
Referenced by dpp::ssl_client::connect().
|
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 |
Referenced by dpp::cluster::global_bulk_command_create(), dpp::cluster::guild_command_create(), dpp::cluster::guild_command_edit_permissions(), dpp::cluster::guild_get_integrations(), dpp::cluster::guild_get_widget(), dpp::cluster::guild_modify_integration(), dpp::cluster::interaction_response_get_original(), dpp::cluster::message_delete_all_reactions(), dpp::cluster::message_delete_own_reaction(), and dpp::cluster::thread_edit().
|
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 |
Referenced by dpp::cluster::guild_commands_get(), dpp::cluster::interaction_followup_edit_original(), dpp::cluster::message_add_reaction(), and dpp::cluster::message_edit().
|
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 |
Referenced by dpp::cluster::guild_sticker_delete().
|
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:
T | any unique 'tag' identifier name |
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
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? |
Referenced by connect_with_timeout(), dpp::discord_voice_client::handle_frame(), and dpp::ssl_client::read_loop().
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 | ) |
References dpp::unicode_emoji::sa.
Referenced by dpp::ssl_client::ssl_client().
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
void 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 |
References dpp::unicode_emoji::v.
Referenced by dpp::scheduled_event::load_image().
void 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 |
References crossplatform_strptime(), dpp::utility::timestamp(), dpp::unicode_emoji::tm, and dpp::unicode_emoji::v.
uint64_t 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 |
Referenced by dpp::cluster::current_user_join_thread(), dpp::role::fill_from_json(), dpp::invite::fill_from_json_impl(), dpp::audit_entry::fill_from_json_impl(), dpp::cluster::guild_get_member(), dpp::discord_voice_client::handle_frame(), dpp::message::is_ephemeral(), and dpp::interaction_modal_response::set_title().
std::string 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 |
Referenced by dpp::command_option::add_channel_type(), dpp::component::add_select_option(), dpp::embed::embed(), dpp::invite::fill_from_json_impl(), dpp::audit_entry::fill_from_json_impl(), dpp::user_identified::fill_from_json_impl(), dpp::presence::presence(), and dpp::slashcommand::set_application_id().
T dpp::sync | ( | class cluster * | c, |
F | func, | ||
Ts &&... | args | ||
) |
Call a D++ REST function synchronously.
Synchronously calling a REST function means IT WILL BLOCK - This is a Bad Thingâ„¢ and strongly discouraged. There are very few circumstances you actually need this. If you do need to use this, you'll know it.
Example:
T | type of expected return value, should match up with the method called |
F | Type of class method in dpp::cluster to call. |
Ts | Function parameters in method call |
c | A pointer to dpp::cluster object |
func | pointer to class method in dpp::cluster to call. This can call any dpp::cluster member function who's last parameter is a dpp::command_completion_event_t callback type. |
args | Zero or more arguments for the method call |
dpp::rest_exception | On failure of the method call, an exception is thrown |
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 |
Referenced by dpp::utility::debug_dump(), and dpp::utility::iconhash::to_string().
void dpp::to_json | ( | json & | j, |
const attachment & | a | ||
) |
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 |
References dpp::command_option::max_value, and dpp::command_option::min_value.
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 |
Referenced by dpp::utility::current_date_time().
time_t 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 |
References crossplatform_strptime(), dpp::utility::timestamp(), and dpp::unicode_emoji::tm.
Referenced by dpp::invite::fill_from_json_impl().
std::string dpp::ts_to_string | ( | time_t | ts | ) |
Convert time_t unix epoch to std::string ISO date/time.
ts | Timestamp to convert |
References dpp::unicode_emoji::tm.
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 | ( | ) |
template bool DPP_EXPORT dpp::validate_configuration< build_type::debug > | ( | ) |
template bool DPP_EXPORT dpp::validate_configuration< build_type::release > | ( | ) |
template bool DPP_EXPORT dpp::validate_configuration< build_type::universal > | ( | ) |
dpp::when_any | ( | Args... | ) | -> when_any< detail::when_any::awaitable_type< Args >... > |
thread_local std::string dpp::audit_reason |
An audit reason for each thread.
These are per-thread to make the cluster methods like cluster::get_audit_reason and cluster::set_audit_reason thread safe across multiple threads. You must ensure you set the audit reason on the same thread that makes the request associated with it.
Referenced by dpp::cluster::set_presence().
const uint16_t dpp::DEFAULT_FORUM_LAYOUT_MASK = 0b0000011000000000 |
Referenced by dpp::channel::get_mention().
std::mutex dpp::deletion_mutex |
std::unordered_map< managed *, time_t > dpp::deletion_queue |
|
inlinestaticconstexpr |
dns_cache_t dpp::dns_cache |
std::shared_mutex dpp::dns_cache_mutex |
const int dpp::ERROR_STATUS = -1 |
Referenced by dpp::ssl_client::connect().
|
static |
Referenced by dpp::discord_client::handle_event().
std::string dpp::external_ip |
Referenced by dpp::discord_voice_client::handle_frame().
const std::map<std::string, std::variant<dpp::guild_flags, dpp::guild_flags_extra> > dpp::featuremap |
const uint8_t dpp::FORMAT_VERSION = 131 |
Current ETF format version in use.
|
inlinestatic |
Referenced by dpp::websocket_client::websocket_client().
|
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.
thread_local std::unordered_map<std::string, keepalive_cache_t> dpp::keepalives |
Keepalive sessions, per-thread.
Referenced by dpp::ssl_client::close(), and dpp::ssl_client::ssl_client().
|
static |
Stores the most recent ping message on this shard, which we check for to monitor latency.
Referenced by dpp::discord_client::one_second_timer().
timer dpp::lasthandle = 1 |
const size_t dpp::MAX_ICON_SIZE = 256 * 1024 |
|
constexpr |
std::map<uint16_t , dpp::guild_member_flags> dpp::membermap |
|
constexpr |
thread_local std::unique_ptr<SSL_CTX, openssl_context_deleter> dpp::openssl_context |
OpenSSL context.
Referenced by dpp::ssl_client::connect().
|
constexpr |
Referenced by dpp::discord_voice_client::discord_voice_client().
|
constexpr |
std::map<uint8_t, dpp::role_flags> dpp::rolemap |
|
inlineconstexpr |
Referenced by dpp::discord_voice_client::send_audio_raw().
std::mutex dpp::timer_guard |
std::map<uint32_t, dpp::user_flags> dpp::usermap |
|
constexpr |
|
constexpr |
Referenced by dpp::websocket_client::get_state().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |