D++ (DPP)
C++ Discord API Bot Library
|
The main namespace for D++ functions. classes and types. More...
Namespaces | |
namespace | colors |
predefined color constants | |
namespace | embed_type |
Represents possible values for the dpp::embed type field. These are loosely defined by the API docs and do not influence how the client renders embeds. The only type a bot can send is dpp::embed_type::emt_rich. | |
namespace | events |
The events namespace holds the internal event handlers for each websocket event. These are handled internally and also dispatched to the user code if the event is hooked. | |
namespace | utility |
Utility helper functions, generally for logging, running programs, time/date manipulation, etc. | |
Classes | |
class | activity |
An activity is a representation of what a user is doing. It might be a game, or a website, or a movie. Whatever. More... | |
struct | activity_assets |
An activity asset are the images and the hover text displayed in the rich presence. More... | |
struct | activity_button |
An activity button is a custom button shown in the rich presence. Can be to join a game or whatever. More... | |
struct | activity_party |
Information for the current party of the player. More... | |
struct | activity_secrets |
Secrets for Rich Presence joining and spectating. More... | |
class | 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... | |
struct | attachment |
Represents an attachment in a dpp::message. 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... | |
struct | awaitable |
class | ban |
The ban class represents a ban on a guild. More... | |
struct | bucket_t |
A rate limit bucket. The library builds one of these for each endpoint. More... | |
struct | button_click_t |
Click on button. More... | |
class | cache |
A cache object maintains a cache of dpp::managed objects. More... | |
class | cache_exception |
Represents invalid access to dpp's cache or its members, which may or may not exist. More... | |
struct | cache_policy_t |
Represents the caching policy of the cluster. More... | |
class | channel |
A definition of a discord channel There are one of these for every channel type except threads. Threads are special snowflakes. Get it? A Discord pun. Hahaha. .... I'll get my coat. More... | |
class | channel_collector |
Channel collector. Collects channels during a set timeframe and returns them in a list via the completed() method. More... | |
struct | channel_create_t |
Create channel. More... | |
struct | channel_delete_t |
Delete channel. More... | |
struct | channel_pins_update_t |
Channel pins update. More... | |
struct | channel_update_t |
Update channel. More... | |
class | cluster |
The cluster class represents a group of shards and a command queue for sending and receiving commands from discord via HTTP. You should usually instantiate a cluster object at the very least to make use of the library. More... | |
class | collected_reaction |
Represents a reaction. Can be filled for use in a collector. More... | |
class | collector |
Collects objects from events during a specified time period. More... | |
struct | command_data_option |
Values in the command interaction. These are the values specified by the user when actually issuing the command on a channel or in DM. More... | |
struct | command_info_t |
Represents the details of a command added to the command handler class. More... | |
struct | command_interaction |
Details of a command within an interaction. This subobject represents the application command associated with the interaction. More... | |
struct | command_option |
Each command option is a command line parameter. It can have a type (see dpp::command_option_type), a name, a description, can be required or optional, and can have zero or more choices (for multiple choice), plus options. Adding options acts like sub-commands and can contain more options. More... | |
struct | command_option_choice |
This struct represents choices in a multiple choice option for a command parameter. It has both a string name, and a value parameter which is a variant, meaning it can hold different potential types (see dpp::command_value) that you can retrieve with std::get(). More... | |
class | command_permission |
Application command permissions allow you to enable or disable commands for specific users or roles within a guild. More... | |
struct | command_resolved |
Resolved snowflake ids to users, guild members, roles and channels. More... | |
struct | command_source |
Represents the sending source of a command. This is passed to any command handler and should be passed back to commandhandler::reply(), allowing the reply method to route any replies back to the origin, which may be a slash command or a message. Both require different response facilities but we want this to be transparent if you use the command handler class. More... | |
class | commandhandler |
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions. More... | |
class | component |
Represents the component object. A component is a clickable button or drop down list within a discord message, where the buttons emit on_button_click events when the user interacts with them. More... | |
struct | component_interaction |
A button click for a button component. More... | |
struct | confirmation |
Confirmation object represents any true or false simple REST request. More... | |
struct | confirmation_callback_t |
The results of a REST call wrapped in a convenient struct. More... | |
class | connection |
The connection object that the user has attached. More... | |
class | connection_exception |
Represents an error establishing or maintaining a connection. More... | |
struct | context_menu_t |
Base class for context menu interactions, e.g. right click on user or message. More... | |
class | discord_client |
Implements a discord client. Each discord_client connects to one shard and derives from a websocket client. More... | |
class | discord_voice_client |
Implements a discord voice connection. Each discord_voice_client connects to one voice channel and derives from a websocket client. More... | |
struct | dns_cache_entry |
Represents a cached DNS result. Used by the ssl_client class to store cached copies of dns lookups. More... | |
class | dtemplate |
Represents a guild template. More... | |
struct | embed |
A rich embed for display within a dpp::message. More... | |
struct | embed_author |
Author within a dpp::embed object. More... | |
struct | embed_field |
A dpp::embed may contain zero or more fields. More... | |
struct | embed_footer |
A footer in a dpp::embed. More... | |
struct | embed_image |
An video, image or thumbnail in a dpp::embed. More... | |
struct | embed_provider |
Embed provider in a dpp::embed. Received from discord but cannot be sent. More... | |
class | emoji |
Represents an emoji for a dpp::guild. More... | |
struct | error_detail |
The details of a field in an error response. More... | |
struct | error_info |
The full details of an error from a REST response. More... | |
struct | etf_buffer |
Represents a buffer of bytes being encoded into ETF. More... | |
class | etf_parser |
The etf_parser class can serialise and deserialise ETF (Erlang Term Format) into and out of an nlohmann::json object, so that layers above the websocket don't have to be any different for handling ETF. More... | |
struct | event_dispatch_t |
Base event parameter struct. Each event you receive from the library will have its parameter derived from this class. The class contains the raw event data, and a pointer to the current shard's dpp::discord_client object. You can also use this object to cancel the current event, meaning that any listeners after yours do not get notified of the current event if you call it. More... | |
struct | event_entities |
Entities for the event. More... | |
struct | event_member |
Represents a guild member/user who has registered interest in an event. More... | |
class | event_router_t |
Handles routing of an event to multiple listeners. 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 |
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_ban_add_t |
Guild ban add. More... | |
struct | guild_ban_remove_t |
Guild ban remove. More... | |
class | guild_command_permissions |
Returned when fetching the permissions for a command in a guild. More... | |
struct | guild_create_t |
Create guild. More... | |
struct | guild_delete_t |
Delete guild. More... | |
struct | guild_emojis_update_t |
Guild emojis update. More... | |
struct | guild_integrations_update_t |
Guild integrations update. More... | |
struct | guild_join_request_delete_t |
Guild join request delete (user declined membership screening) More... | |
class | guild_member |
Represents dpp::user membership upon a dpp::guild. This contains the user's nickname, guild roles, and any other guild-specific flags. More... | |
struct | guild_member_add_t |
Guild member add. More... | |
struct | guild_member_remove_t |
Guild member remove. More... | |
struct | guild_member_update_t |
Guild member update. More... | |
struct | guild_members_chunk_t |
Guild members chunk. More... | |
struct | guild_role_create_t |
Guild role create. More... | |
struct | guild_role_delete_t |
Guild role delete. More... | |
struct | guild_role_update_t |
Guild role update. More... | |
struct | guild_scheduled_event_create_t |
Create scheduled event. More... | |
struct | guild_scheduled_event_delete_t |
Delete scheduled event. More... | |
struct | guild_scheduled_event_update_t |
Create scheduled event. More... | |
struct | guild_scheduled_event_user_add_t |
Add user to scheduled event. More... | |
struct | guild_scheduled_event_user_remove_t |
Delete user from scheduled event. More... | |
struct | guild_stickers_update_t |
Update guild stickers. More... | |
struct | guild_update_t |
Guild update. More... | |
class | guild_widget |
Represents a guild widget, simple web widget of member list. More... | |
struct | http_connect_info |
Represents a HTTP scheme, hostname and port split into parts for easy use in https_client. More... | |
class | http_request |
A HTTP request. More... | |
struct | http_request_completion_t |
The result of any HTTP request. Contains the headers, vital rate limit figures, and returned request body. More... | |
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. There are several of these, the total defined by a constant in queues.cpp, and each one will always receive requests for the same rate limit bucket based on its endpoint portion of the url. This makes rate limit handling reliable and easy to manage. Each of these also has its own mutex, so that requests are less likely to block while waiting for internal containers to be usable. More... | |
class | integration |
Represents an integration on a guild, e.g. a connection to twitch. 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. This is further split into the events on_form_submit, on_slashcommand, on_user_context_menu, on_button_click, on_select_menu, etc. More... | |
struct | interaction_create_t |
Create interaction. More... | |
struct | interaction_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... | |
struct | json_interface |
Represents an interface for an object that can optionally implement functions for converting to and from nlohmann::json. In the event either parse_from_json() or build_json() are not implemented and are called, they will throw at runtime. More... | |
class | length_exception |
Represents invalid length of argument being passed to a function. More... | |
struct | log_t |
Log messages. More... | |
class | logic_exception |
Represents an error in logic, e.g. you asked the library to do something the Discord API does not support. More... | |
class | managed |
The managed class is the base class for various types that can be stored in a cache that are identified by a dpp::snowflake id. More... | |
struct | message |
Represents messages sent and received on Discord. More... | |
class | message_collector |
Message collector. Collects messages during a set timeframe and returns them in a list via the completed() method. More... | |
struct | message_context_menu_t |
Event parameter for context menu interactions for messages. More... | |
struct | message_create_t |
Create message. More... | |
struct | message_delete_bulk_t |
Message delete bulk. More... | |
struct | message_delete_t |
Message Deleted. More... | |
struct | message_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 | 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... | |
class | oneshot_timer |
Trigger a timed event once. The provided callback is called only once. More... | |
struct | param_info |
Details of a command parameter used in registration. Note that for non-slash commands optional parameters can only be at the end of the list of parameters. More... | |
class | parse_exception |
Represents inability to parse data, usually caused by malformed JSON or ETF. More... | |
class | permission |
Represents a permission bitmask (refer to enum dpp::permissions) which are hold in an uint64_t. More... | |
struct | permission_overwrite |
Channel permission overwrites. More... | |
class | presence |
Represents user presence, e.g. what game they are playing and if they are online. More... | |
struct | presence_update_t |
Presence update. More... | |
struct | promise |
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. Collects message reactions during a set timeframe and returns them in a list via the completed() method. More... | |
struct | ready_t |
Session ready. More... | |
class | request_queue |
The request_queue class manages rate limits and marshalls HTTP requests that have been built as http_request objects. More... | |
struct | resolved_user |
dpp::resolved_user contains both a dpp::guild_member and a dpp::user. The user can be used to obtain in-depth user details such as if they are nitro, and the guild member information to check their roles on a guild etc. The Discord API provides both if a parameter is a user ping, so we offer both in a combined structure. More... | |
class | rest_exception |
Represents an error on a REST API call, e.g. a HTTPS request. More... | |
struct | resumed_t |
Session resumed. More... | |
class | role |
Represents a role within a dpp::guild. Roles are combined via logical OR of the permission bitmasks, then channel-specific overrides can be applied on top, deny types apply a logic NOT to the bit mask, and allows apply a logical OR. More... | |
class | role_collector |
Role collector. Collects guild roles during a set timeframe and returns them in a list via the completed() method. More... | |
struct | scheduled_event |
A scheduled event. More... | |
class | scheduled_event_collector |
Scheduled event collector. Collects messages during a set timeframe and returns them in a list via the completed() method. More... | |
struct | select_click_t |
Click on select. More... | |
struct | select_option |
An option for a select component. More... | |
class | 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 | ssl_client |
Implements a simple non-blocking SSL stream client. More... | |
struct | stage_instance |
A stage instance. Stage instances are like a conference facility, with moderators/speakers and listeners. More... | |
struct | stage_instance_create_t |
Create stage instance. More... | |
struct | stage_instance_delete_t |
Delete stage instance. More... | |
struct | stage_instance_update_t |
Update stage instance. More... | |
struct | sticker |
Represents stickers received in messages. More... | |
struct | sticker_pack |
Represents a sticker pack (the built in groups of stickers that all nitro users get to use) More... | |
struct | task |
class | team_member |
Represents a team member on a team who maintain a bot/application. More... | |
class | thread |
A definition of a discord thread. A thread is a superset of a channel. Not to be confused with std::thread ! More... | |
class | thread_collector |
Thread collector. Collects threads during a set timeframe and returns them in a list via the completed() method. More... | |
struct | thread_create_t |
Thread Create. More... | |
struct | thread_delete_t |
Thread Delete. More... | |
struct | thread_list_sync_t |
Thread List Sync. More... | |
struct | thread_member |
represents membership of a user with a thread More... | |
struct | thread_member_update_t |
Thread Member Update. More... | |
struct | thread_members_update_t |
Thread Members Update. More... | |
struct | thread_metadata |
metadata for threads More... | |
struct | thread_update_t |
Thread Update. More... | |
class | timed_listener |
A timed_listener is a way to temporarily attach to an event for a specific timeframe, then detach when complete. A lambda may also be optionally called when the timeout is reached. Destructing the timed_listener detaches any attached event listeners, and cancels any created timers, but does not call any timeout lambda. More... | |
struct | timer_t |
Used internally to store state of active timers. More... | |
union | type_punner |
A horrible structure used within the ETF parser to convert uint64_t to double and back. This is horrible, but it is the official way erlang term format does this, so we can't really mess with it much. More... | |
struct | typing_start_t |
Typing start. More... | |
class | user |
Represents a user on discord. May or may not be a member of a dpp::guild. More... | |
struct | user_context_menu_t |
Event parameter for context menu interactions for users. More... | |
class | user_identified |
A user with additional fields only available via the oauth2 identify scope. These are not included in dpp::user as additional scopes are needed to fetch them which bots do not normally have. More... | |
struct | user_update_t |
User update. More... | |
struct | version_checker |
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. A client can only connect to one voice channel per guild at a time, so these are stored in a map in the dpp::discord_client keyed by guild_id. More... | |
class | voiceregion |
Represents a voice region on discord. More... | |
class | voicestate |
Represents the voice state of a user on a guild These are stored in the dpp::guild object, and accessible there, or via dpp::channel::get_voice_members. More... | |
class | webhook |
Represents a discord webhook. More... | |
struct | webhooks_update_t |
Webhooks update. More... | |
class | websocket_client |
Implements a websocket client based on the SSL client. More... | |
struct | welcome_channel_t |
Defines a channel on a server's welcome screen. More... | |
struct | welcome_screen_t |
Defines a server's welcome screen. More... | |
Typedefs | |
typedef std::variant< std::monostate, std::string, int64_t, bool, snowflake, double > | command_value |
This type is a variant that can hold any of the potential native data types represented by the enum above. It is used in interactions. More... | |
typedef std::variant< std::monostate, int64_t, double > | command_option_range |
A minimum or maximum value for co_number and co_integer dpp::command_option types. More... | |
typedef std::unordered_map< snowflake, slashcommand > | slashcommand_map |
A group of application slash commands. More... | |
typedef std::unordered_map< snowflake, guild_command_permissions > | guild_command_permissions_map |
A group of guild command permissions. More... | |
typedef std::unordered_map< snowflake, application > | application_map |
typedef std::unordered_map< snowflake, automod_rule > | automod_rule_map |
typedef std::unordered_map< snowflake, ban > | ban_map |
typedef std::unordered_map< snowflake, thread_member > | thread_member_map |
A group of thread member objects. More... | |
typedef std::unordered_map< snowflake, channel > | channel_map |
A group of channels. More... | |
typedef std::unordered_map< snowflake, thread > | thread_map |
A group of threads. More... | |
typedef std::variant< std::monostate, std::string, dpp::role, dpp::channel, dpp::resolved_user, int64_t, bool, double > | command_parameter |
Represents a received parameter. We use variant so that multiple non-related types can be contained within. More... | |
typedef std::vector< std::pair< std::string, param_info > > | parameter_registration_t |
Parameter list used during registration. Note that use of vector/pair is important here to preserve parameter order, as opposed to unordered_map (which doesn't guarantee any order at all) and std::map, which reorders keys alphabetically. More... | |
typedef std::vector< std::pair< std::string, command_parameter > > | parameter_list_t |
Parameter list for a called command. See dpp::parameter_registration_t for an explanation as to why vector is used. More... | |
typedef std::function< void(const std::string &, const parameter_list_t &, command_source)> | command_handler |
The function definition for a command handler. Expects a command name string, and a list of command parameters. More... | |
using | handle_type = std::coroutine_handle< struct promise > |
typedef std::function< void(const confirmation_callback_t &)> | command_completion_event_t |
A function used as a callback for any REST based command. More... | |
using | dns_cache_t = std::unordered_map< std::string, dns_cache_entry * > |
Cache container type. More... | |
typedef dpp::collector< dpp::channel_create_t, dpp::channel > | channel_collector_t |
Template type for base class of channel collector. More... | |
typedef dpp::collector< dpp::thread_create_t, dpp::thread > | thread_collector_t |
Template type for base class of thread collector. More... | |
typedef dpp::collector< dpp::guild_role_create_t, dpp::role > | role_collector_t |
Template type for base class of role collector. More... | |
typedef dpp::collector< dpp::guild_scheduled_event_create_t, dpp::scheduled_event > | scheduled_event_collector_t |
Template type for base class of scheduled event collector. More... | |
typedef dpp::collector< dpp::message_create_t, dpp::message > | message_collector_t |
Template type for base class of message collector. More... | |
typedef dpp::collector< dpp::message_reaction_add_t, dpp::collected_reaction > | reaction_collector_t |
Template type for base class of message reaction collector. More... | |
typedef std::unordered_map< snowflake, dtemplate > | dtemplate_map |
typedef std::unordered_map< snowflake, emoji > | emoji_map |
Group of emojis. More... | |
typedef std::unordered_map< snowflake, guild_member > | members_container |
Guild members container. More... | |
typedef std::unordered_map< snowflake, guild > | guild_map |
typedef std::unordered_map< snowflake, guild_member > | guild_member_map |
typedef std::multimap< std::string, std::string > | http_headers |
Request headers. More... | |
typedef std::unordered_map< snowflake, integration > | integration_map |
typedef std::unordered_map< snowflake, connection > | connection_map |
typedef std::unordered_map< std::string, invite > | invite_map |
typedef std::unordered_map< snowflake, message > | message_map |
typedef std::unordered_map< snowflake, sticker > | sticker_map |
typedef std::unordered_map< snowflake, sticker_pack > | sticker_pack_map |
typedef size_t | event_handle |
A returned event handle for an event which was attached. More... | |
using | role_permissions = permissions |
Represents the various discord permissions. More... | |
typedef std::unordered_map< snowflake, presence > | presence_map |
typedef std::function< void(const http_request_completion_t &)> | http_completion_event |
Results of HTTP requests are called back to these std::function types. More... | |
typedef std::map< uint32_t, class discord_client * > | shard_list |
A list of shards. More... | |
typedef std::variant< 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 > | confirmable_t |
A container for types that can be returned for a REST API call. More... | |
typedef std::function< void(json &, const http_request_completion_t &)> | json_encode_t |
Automatically JSON encoded HTTP result. More... | |
typedef std::unordered_map< snowflake, role > | role_map |
typedef std::unordered_map< snowflake, scheduled_event > | scheduled_event_map |
A group of scheduled events. More... | |
typedef std::unordered_map< snowflake, event_member > | event_member_map |
A group of scheduled event members. More... | |
typedef uint64_t | snowflake |
A 64 bit unsigned value representing many things on discord. Discord calls the value a 'snowflake' value. More... | |
typedef int | socket |
Represents a socket file descriptor. This is used to ensure parity between windows and unix-like systems. 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 |
typedef size_t | timer |
Represents a timer handle. Returned from cluster::start_timer and used by cluster::stop_timer. This is obtained from a simple incrementing value, internally. More... | |
typedef std::function< void(timer)> | timer_callback_t |
The type for a timer callback. More... | |
typedef std::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 |
typedef std::unordered_map< std::string, voiceregion > | voiceregion_map |
A group of voice regions. More... | |
typedef std::unordered_map< std::string, voicestate > | voicestate_map |
typedef std::unordered_map< snowflake, webhook > | webhook_map |
A group of webhooks. More... | |
Enumerations | |
enum | command_option_type : uint8_t { co_sub_command = 1 , co_sub_command_group = 2 , co_string = 3 , co_integer = 4 , co_boolean = 5 , co_user = 6 , co_channel = 7 , co_role = 8 , co_mentionable = 9 , co_number = 10 , co_attachment = 11 } |
Represents command option types. These are the possible parameter value types. More... | |
enum | interaction_response_type { ir_pong = 1 , ir_channel_message_with_source = 4 , ir_deferred_channel_message_with_source = 5 , ir_deferred_update_message = 6 , ir_update_message = 7 , ir_autocomplete_reply = 8 , ir_modal_dialog = 9 } |
Response types when responding to an interaction within on_interaction_create. Do not use ir_acknowledge or ir::channel_message, as these are deprecated in the Discord API spec. They are listed in this enum for completeness. More... | |
enum | interaction_type { it_ping = 1 , it_application_command = 2 , it_component_button = 3 , it_autocomplete = 4 , it_modal_submit = 5 } |
enum | slashcommand_contextmenu_type { ctxm_none = 0 , ctxm_chat_input = 1 , ctxm_user = 2 , ctxm_message = 3 } |
Right-click context menu types. More... | |
enum | component_type_t { cotype_button = 2 , cotype_select = 3 } |
Component type, either button or select. More... | |
enum | command_permission_type { cpt_role = 1 , cpt_user = 2 } |
type of permission in the dpp::command_permission class More... | |
enum | team_member_status : uint8_t { tms_invited = 1 , tms_accepted = 2 } |
status of a member of a team who maintain a bot/application More... | |
enum | application_flags : uint32_t { apf_gateway_presence = (1 << 12) , apf_gateway_presence_limited = (1 << 13) , apf_gateway_guild_members = (1 << 14) , apf_gateway_guild_members_limited = (1 << 15) , apf_verification_pending_guild_limit = (1 << 16) , apf_embedded = (1 << 17) , apf_gateway_message_content = (1 << 18) , apf_gateway_message_content_limited = (1 << 19) } |
Flags for a bot or application. More... | |
enum | audit_type { aut_guild_update = 1 , aut_channel_create = 10 , aut_channel_update = 11 , aut_channel_delete = 12 , aut_channel_overwrite_create = 13 , aut_channel_overwrite_update = 14 , aut_channel_overwrite_delete = 15 , aut_member_kick = 20 , aut_member_prune = 21 , aut_member_ban_add = 22 , aut_member_ban_remove = 23 , aut_member_update = 24 , aut_member_role_update = 25 , aut_member_move = 26 , aut_member_disconnect = 27 , aut_bot_add = 28 , aut_role_create = 30 , aut_role_update = 31 , aut_role_delete = 32 , aut_invite_create = 40 , aut_invite_update = 41 , aut_invite_delete = 42 , aut_webhook_create = 50 , aut_webhook_update = 51 , aut_webhook_delete = 52 , aut_emoji_create = 60 , aut_emoji_update = 61 , aut_emoji_delete = 62 , aut_message_delete = 72 , aut_message_bulk_delete = 73 , aut_message_pin = 74 , aut_message_unpin = 75 , aut_integration_create = 80 , aut_integration_update = 81 , aut_integration_delete = 82 , aut_stage_instance_create = 83 , aut_stage_instance_update = 84 , aut_stage_instance_delete = 85 , aut_sticker_create = 90 , aut_sticker_update = 91 , aut_sticker_delete = 92 , aut_guild_scheduled_event_create = 100 , aut_guild_scheduled_event_update = 101 , aut_guild_scheduled_event_delete = 102 , aut_thread_create = 110 , aut_thread_update = 111 , aut_thread_delete = 112 , aut_appcommand_permission_update = 121 , aut_automod_rule_create = 140 , aut_automod_rule_update = 141 , aut_automod_rule_delete = 142 , aut_automod_block_message = 143 } |
Defines types of audit log entry. More... | |
enum | automod_preset_type : uint8_t { amod_preset_profanity = 1 , amod_preset_sexual_content = 2 , amod_preset_slurs = 3 } |
Possible types of preset filter lists. More... | |
enum | automod_action_type : uint8_t { amod_action_block_message = 1 , amod_action_send_alert = 2 , amod_action_timeout = 3 } |
Action types to perform on filtering. More... | |
enum | automod_event_type : uint8_t { amod_message_send = 1 } |
Event types, only message send is currently supported. More... | |
enum | automod_trigger_type : uint8_t { amod_type_keyword = 1 , amod_type_harmful_link = 2 , amod_type_spam = 3 , amod_type_keyword_preset = 4 } |
Types of moderation to trigger. More... | |
enum | channel_type : uint8_t { CHANNEL_TEXT = 0 , DM = 1 , CHANNEL_VOICE = 2 , GROUP_DM = 3 , CHANNEL_CATEGORY = 4 , CHANNEL_NEWS = 5 , CHANNEL_STORE = 6 , CHANNEL_NEWS_THREAD = 10 , CHANNEL_PUBLIC_THREAD = 11 , CHANNEL_PRIVATE_THREAD = 12 , CHANNEL_STAGE = 13 , CHANNEL_DIRECTORY = 14 , CHANNEL_FORUM = 15 } |
Flag integers as received from and sent to discord. More... | |
enum | channel_flags : uint8_t { c_nsfw = 0b00010000 , c_video_quality_720p = 0b00100000 , c_lock_permissions = 0b01000000 , c_pinned_thread = 0b10000000 } |
Our flags as stored in the object. More... | |
enum | discord_channel_flags : uint8_t { dc_pinned_thread = 0b00000001 } |
The flags in discord channel's raw "flags" field. We use these for serialisation only, right now. Might be better to create a new field than to make the existing channel::flags from uint8_t to uint16_t, if discord adds more flags in future. More... | |
enum | overwrite_type : uint8_t { ot_role = 0 , ot_member = 1 } |
channel permission overwrite types More... | |
enum | start_type : bool { st_wait = false , st_return = true } |
Types of startup for cluster::start() More... | |
enum | parameter_type { pt_string , pt_role , pt_channel , pt_user , pt_integer , pt_double , pt_boolean } |
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. More... | |
enum | emoji_flags : uint8_t { e_require_colons = 0b00000001 , e_managed = 0b00000010 , e_animated = 0b00000100 , e_available = 0b00001000 } |
Flags for dpp::emoji. More... | |
enum | etf_token_type : uint8_t { ett_distribution = 'D' , ett_new_float = 'F' , ett_bit_binary = 'M' , ett_compressed = 'P' , ett_smallint = 'a' , ett_integer = 'b' , ett_float = 'c' , ett_atom = 'd' , ett_reference = 'e' , ett_port = 'f' , ett_pid = 'g' , ett_small_tuple = 'h' , ett_large_tuple = 'i' , ett_nil = 'j' , ett_string = 'k' , ett_list = 'l' , ett_binary = 'm' , ett_bigint_small = 'n' , ett_bigint_large = 'o' , ett_new_function = 'p' , ett_export = 'q' , ett_new_reference = 'r' , ett_atom_small = 's' , ett_map = 't' , ett_function = 'u' , ett_atom_utf8 = 'v' , ett_atom_utf8_small = 'w' } |
Represents a token which identifies the type of value which follows it in the ETF binary structure. More... | |
enum | region : uint8_t { r_brazil , r_central_europe , r_hong_kong , r_india , r_japan , r_russia , r_singapore , r_south_africa , r_sydney , r_us_central , r_us_east , r_us_south , r_us_west , r_western_europe } |
Represents voice regions for guilds and channels. More... | |
enum | guild_flags : uint32_t { g_large = 0b00000000000000000000000000000001 , g_unavailable = 0b00000000000000000000000000000010 , g_widget_enabled = 0b00000000000000000000000000000100 , g_invite_splash = 0b00000000000000000000000000001000 , g_vip_regions = 0b00000000000000000000000000010000 , g_vanity_url = 0b00000000000000000000000000100000 , g_verified = 0b00000000000000000000000001000000 , g_partnered = 0b00000000000000000000000010000000 , g_community = 0b00000000000000000000000100000000 , g_commerce = 0b00000000000000000000001000000000 , g_news = 0b00000000000000000000010000000000 , g_discoverable = 0b00000000000000000000100000000000 , g_featureable = 0b00000000000000000001000000000000 , g_animated_icon = 0b00000000000000000010000000000000 , g_banner = 0b00000000000000000100000000000000 , g_welcome_screen_enabled = 0b00000000000000001000000000000000 , g_member_verification_gate = 0b00000000000000010000000000000000 , g_preview_enabled = 0b00000000000000100000000000000000 , g_no_join_notifications = 0b00000000000001000000000000000000 , g_no_boost_notifications = 0b00000000000010000000000000000000 , g_has_animated_icon = 0b00000000000100000000000000000000 , g_has_animated_banner = 0b00000000001000000000000000000000 , g_no_setup_tips = 0b00000000010000000000000000000000 , g_no_sticker_greeting = 0b00000000100000000000000000000000 , g_monetization_enabled = 0b00000001000000000000000000000000 , g_more_stickers = 0b00000010000000000000000000000000 , g_private_threads = 0b00000100000000000000000000000000 , g_role_icons = 0b00001000000000000000000000000000 , g_seven_day_thread_archive = 0b00010000000000000000000000000000 , g_three_day_thread_archive = 0b00100000000000000000000000000000 , g_ticketed_events = 0b01000000000000000000000000000000 , g_channel_banners = 0b10000000000000000000000000000000 } |
The various flags that represent the status of a dpp::guild object. More... | |
enum | guild_flags_extra : uint8_t { g_premium_progress_bar_enabled = 0b00000001 , g_animated_banner = 0b00000010 , g_auto_moderation = 0b00000100 } |
Additional boolean flag values for guild, as guild_flags is full. More... | |
enum | guild_member_flags : uint8_t { gm_deaf = 0b00001 , gm_mute = 0b00010 , gm_pending = 0b00100 , gm_animated_avatar = 0b01000 , gm_voice_action = 0b10000 } |
Various flags that can be used to indicate the status of a guild member. More... | |
enum | guild_nsfw_level_t : uint8_t { nsfw_default = 0 , nsfw_explicit = 1 , nsfw_safe = 2 , nsfw_age_restricted = 3 } |
Guild NSFW level. Used to represent just how naughty this guild is. Naughty guild, go sit in the corner. More... | |
enum | guild_explicit_content_t : uint8_t { expl_disabled = 0 , expl_members_without_roles = 1 , expl_all_members = 2 } |
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. More... | |
enum | mfa_level_t : uint8_t { mfa_none = 0 , mfa_elevated = 1 } |
MFA level for server. If set to elevated all moderators need MFA to perform specific actions such as kick or ban. More... | |
enum | verification_level_t : uint8_t { ver_none = 0 , ver_low = 1 , ver_medium = 2 , ver_high = 3 , ver_very_high = 4 } |
Guild verification level. More... | |
enum | http_state : uint8_t { HTTPS_HEADERS , HTTPS_CONTENT , HTTPS_DONE , HTTPS_CHUNK_LEN , HTTPS_CHUNK_TRAILER , HTTPS_CHUNK_LAST , HTTPS_CHUNK_CONTENT } |
HTTP connection status. More... | |
enum | integration_type { i_twitch , i_youtube , i_discord } |
Integration types. More... | |
enum | integration_flags { if_enabled = 0b00000001 , if_syncing = 0b00000010 , if_emoticons = 0b00000100 , if_revoked = 0b00001000 , if_expire_kick = 0b00010000 } |
Integration flags. More... | |
enum | intents { i_guilds = (1 << 0) , i_guild_members = (1 << 1) , i_guild_bans = (1 << 2) , i_guild_emojis = (1 << 3) , i_guild_integrations = (1 << 4) , i_guild_webhooks = (1 << 5) , i_guild_invites = (1 << 6) , i_guild_voice_states = (1 << 7) , i_guild_presences = (1 << 8) , i_guild_messages = (1 << 9) , i_guild_message_reactions = (1 << 10) , i_guild_message_typing = (1 << 11) , i_direct_messages = (1 << 12) , i_direct_message_reactions = (1 << 13) , i_direct_message_typing = (1 << 14) , i_message_content = (1 << 15) , i_guild_scheduled_events = (1 << 16) , i_auto_moderation_configuration = (1 << 20) , i_auto_moderation_execution = (1 << 21) , i_default_intents , i_privileged_intents = dpp::i_guild_members | dpp::i_guild_presences | dpp::i_message_content , i_all_intents = dpp::i_default_intents | dpp::i_privileged_intents } |
intents are a bitmask of allowed events on your websocket. More... | |
enum | component_type : uint8_t { cot_action_row = 1 , cot_button = 2 , cot_selectmenu = 3 , cot_text = 4 } |
Represents the type of a component. More... | |
enum | text_style_type : uint8_t { text_short = 1 , text_paragraph = 2 } |
Types of text input. More... | |
enum | component_style : uint8_t { cos_primary = 1 , cos_secondary , cos_success , cos_danger , cos_link } |
Represents the style of a button. More... | |
enum | sticker_type : uint8_t { st_standard = 1 , st_guild = 2 } |
Represents the type of a sticker. More... | |
enum | sticker_format : uint8_t { sf_png = 1 , sf_apng = 2 , sf_lottie = 3 } |
The file format (png, apng, lottie) of a sticker. More... | |
enum | message_flags { m_crossposted = 1 << 0 , m_is_crosspost = 1 << 1 , m_suppress_embeds = 1 << 2 , m_source_message_deleted = 1 << 3 , m_urgent = 1 << 4 , m_has_thread = 1 << 5 , m_ephemeral = 1 << 6 , m_loading = 1 << 7 } |
Bitmask flags for a dpp::message. More... | |
enum | message_type { mt_default = 0 , mt_recipient_add = 1 , mt_recipient_remove = 2 , mt_call = 3 , mt_channel_name_change = 4 , mt_channel_icon_change = 5 , mt_channel_pinned_message = 6 , mt_guild_member_join = 7 , mt_user_premium_guild_subscription = 8 , mt_user_premium_guild_subscription_tier_1 = 9 , mt_user_premium_guild_subscription_tier_2 = 10 , mt_user_premium_guild_subscription_tier_3 = 11 , mt_channel_follow_add = 12 , mt_guild_discovery_disqualified = 14 , mt_guild_discovery_requalified = 15 , mt_guild_discovery_grace_period_initial_warning = 16 , mt_guild_discovery_grace_period_final_warning = 17 , mt_thread_created = 18 , mt_reply = 19 , mt_application_command = 20 , mt_thread_starter_message = 21 , mt_guild_invite_reminder = 22 , mt_context_menu_command = 23 , mt_auto_moderation_action = 24 } |
Message types for dpp::message::type. More... | |
enum | cache_policy_setting_t { cp_aggressive = 0 , cp_lazy = 1 , cp_none = 2 } |
Represents the caching policy of a cache in the library. More... | |
enum | image_type { i_png , i_jpg , i_gif } |
Supported image types for profile pictures. More... | |
enum | loglevel { ll_trace = 0 , ll_debug , ll_info , ll_warning , ll_error , ll_critical } |
Log levels. More... | |
enum | permissions : uint64_t { p_create_instant_invite = 0x00000000001 , p_kick_members = 0x00000000002 , p_ban_members = 0x00000000004 , p_administrator = 0x00000000008 , p_manage_channels = 0x00000000010 , p_manage_guild = 0x00000000020 , p_add_reactions = 0x00000000040 , p_view_audit_log = 0x00000000080 , p_priority_speaker = 0x00000000100 , p_stream = 0x00000000200 , p_view_channel = 0x00000000400 , p_send_messages = 0x00000000800 , p_send_tts_messages = 0x00000001000 , p_manage_messages = 0x00000002000 , p_embed_links = 0x00000004000 , p_attach_files = 0x00000008000 , p_read_message_history = 0x00000010000 , p_mention_everyone = 0x00000020000 , p_use_external_emojis = 0x00000040000 , p_view_guild_insights = 0x00000080000 , p_connect = 0x00000100000 , p_speak = 0x00000200000 , p_mute_members = 0x00000400000 , p_deafen_members = 0x00000800000 , p_move_members = 0x00001000000 , p_use_vad = 0x00002000000 , p_change_nickname = 0x00004000000 , p_manage_nicknames = 0x00008000000 , p_manage_roles = 0x00010000000 , p_manage_webhooks = 0x00020000000 , p_manage_emojis_and_stickers = 0x00040000000 , p_use_application_commands = 0x00080000000 , p_request_to_speak = 0x00100000000 , p_manage_events = 0x00200000000 , p_manage_threads = 0x00400000000 , p_create_public_threads = 0x00800000000 , p_create_private_threads = 0x01000000000 , p_use_external_stickers = 0x02000000000 , p_send_messages_in_threads = 0x04000000000 , p_use_embedded_activities = 0x08000000000 , p_moderate_members = 0x10000000000 } |
Represents the various discord permissions. More... | |
enum | presence_flags { p_desktop_online = 0b00000001 , p_desktop_dnd = 0b00000010 , p_desktop_idle = 0b00000011 , p_web_online = 0b00000100 , p_web_dnd = 0b00001000 , p_web_idle = 0b00001100 , p_mobile_online = 0b00010000 , p_mobile_dnd = 0b00100000 , p_mobile_idle = 0b00110000 , p_status_online = 0b01000000 , p_status_dnd = 0b10000000 , p_status_idle = 0b11000000 } |
Presence flags bitmask. More... | |
enum | presence_status : uint8_t { ps_offline = 0 , ps_online = 1 , ps_dnd = 2 , ps_idle = 3 } |
Online presence status values. More... | |
enum | activity_type : uint8_t { at_game = 0 , at_streaming = 1 , at_listening = 2 , at_watching = 3 , at_custom = 4 , at_competing = 5 } |
Game types. More... | |
enum | activity_flags { af_instance = 0b000000001 , af_join = 0b000000010 , af_spectate = 0b000000100 , af_join_request = 0b000001000 , af_sync = 0b000010000 , af_play = 0b000100000 , af_party_privacy_friends = 0b001000000 , af_party_privacy_voice_channel = 0b010000000 , af_embedded = 0b100000000 } |
Activity types for rich presence. More... | |
enum | http_error { h_success = 0 , h_unknown , h_connection , h_bind_ip_address , h_read , h_write , h_exceed_redirect_count , h_canceled , h_ssl_connection , h_ssl_loading_certs , h_ssl_server_verification , h_unsupported_multipart_boundary_chars , h_compression } |
Error values. Most of these are currently unused in https_client. More... | |
enum | http_method { m_get , m_post , m_put , m_patch , m_delete } |
Various types of http method supported by the Discord API. More... | |
enum | role_flags : uint8_t { r_hoist = 0b00000001 , r_managed = 0b00000010 , r_mentionable = 0b00000100 , r_premium_subscriber = 0b00001000 } |
enum | event_privacy_level : uint8_t { ep_guild_only = 2 } |
Represents the privacy of an event. More... | |
enum | event_entity_type : uint8_t { eet_stage_instance = 1 , eet_voice = 2 , eet_external = 3 } |
Event entity types. More... | |
enum | event_status : uint8_t { es_scheduled = 1 , es_active = 2 , es_completed = 3 , es_cancelled = 4 } |
Event status types. More... | |
enum | stage_privacy_level : uint8_t { sp_public = 1 , sp_guild_only = 2 } |
Represents the privacy of a stage instance. More... | |
enum | user_flags : uint32_t { u_bot = 0b00000000000000000000001 , u_system = 0b00000000000000000000010 , u_mfa_enabled = 0b00000000000000000000100 , u_verified = 0b00000000000000000001000 , u_nitro_full = 0b00000000000000000010000 , u_nitro_classic = 0b00000000000000000100000 , u_discord_employee = 0b00000000000000001000000 , u_partnered_owner = 0b00000000000000010000000 , u_hypesquad_events = 0b00000000000000100000000 , u_bughunter_1 = 0b00000000000001000000000 , u_house_bravery = 0b00000000000010000000000 , u_house_brilliance = 0b00000000000100000000000 , u_house_balance = 0b00000000001000000000000 , u_early_supporter = 0b00000000010000000000000 , u_team_user = 0b00000000100000000000000 , u_bughunter_2 = 0b00000001000000000000000 , u_verified_bot = 0b00000010000000000000000 , u_verified_bot_dev = 0b00000100000000000000000 , u_animated_icon = 0b00001000000000000000000 , u_certified_moderator = 0b00010000000000000000000 , u_bot_http_interactions = 0b00100000000000000000000 } |
Various bitmask flags used to represent information about a dpp::user. More... | |
enum | voiceregion_flags { v_optimal = 0x00000001 , v_deprecated = 0x00000010 , v_custom = 0x00000100 , v_vip = 0x00001000 } |
Flags related to a voice region. More... | |
enum | voicestate_flags { vs_deaf = 0b00000001 , vs_mute = 0b00000010 , vs_self_mute = 0b00000100 , vs_self_deaf = 0b00001000 , vs_self_stream = 0b00010000 , vs_self_video = 0b00100000 , vs_suppress = 0b01000000 } |
Bit mask flags relating to voice states. More... | |
enum | webhook_type { w_incoming = 1 , w_channel_follower = 2 } |
Defines types of webhook. More... | |
enum | websocket_protocol_t : uint8_t { ws_json = 0 , ws_etf = 1 } |
Websocket protocol types available on Discord. More... | |
enum | ws_state : uint8_t { HTTP_HEADERS , CONNECTED } |
Websocket connection status. More... | |
enum | ws_opcode : uint8_t { OP_CONTINUATION = 0x00 , OP_TEXT = 0x01 , OP_BINARY = 0x02 , OP_CLOSE = 0x08 , OP_PING = 0x09 , OP_PONG = 0x0a } |
Low-level websocket opcodes for frames. More... | |
Functions | |
void | to_json (nlohmann::json &j, const command_option_choice &choice) |
helper function to serialize a command_option_choice to json More... | |
void | to_json (nlohmann::json &j, const command_option &opt) |
helper function to serialize a command_option to json More... | |
void | from_json (const nlohmann::json &j, command_data_option &cdo) |
helper function to deserialize a command_data_option from json More... | |
void | from_json (const nlohmann::json &j, command_interaction &ci) |
helper function to deserialize a command_interaction from json More... | |
void | from_json (const nlohmann::json &j, component_interaction &bi) |
helper function to deserialize a component_interaction from json More... | |
void | from_json (const nlohmann::json &j, autocomplete_interaction &ai) |
helper function to deserialize an autocomplete_interaction from json More... | |
void | from_json (const nlohmann::json &j, interaction &i) |
helper function to deserialize an interaction from json More... | |
void | to_json (nlohmann::json &j, const command_permission &cp) |
helper function to serialize a command_permission to json More... | |
void | to_json (nlohmann::json &j, const guild_command_permissions &gcp) |
helper function to serialize a guild_command_permissions to json More... | |
void | to_json (nlohmann::json &j, const slashcommand &cmd) |
helper function to serialize a slashcommand to json More... | |
void DPP_EXPORT | garbage_collection () |
DPP_EXPORT class user * | find_user (snowflake id) |
DPP_EXPORT cache< class user > * | get_user_cache () |
DPP_EXPORT uint64_t | get_user_count () |
DPP_EXPORT class guild * | find_guild (snowflake id) |
DPP_EXPORT cache< class guild > * | get_guild_cache () |
DPP_EXPORT uint64_t | get_guild_count () |
DPP_EXPORT class role * | find_role (snowflake id) |
DPP_EXPORT cache< class role > * | get_role_cache () |
DPP_EXPORT uint64_t | get_role_count () |
DPP_EXPORT class channel * | find_channel (snowflake id) |
DPP_EXPORT cache< class channel > * | get_channel_cache () |
DPP_EXPORT uint64_t | get_channel_count () |
DPP_EXPORT class emoji * | find_emoji (snowflake id) |
DPP_EXPORT cache< class emoji > * | get_emoji_cache () |
DPP_EXPORT uint64_t | get_emoji_count () |
void | to_json (nlohmann::json &j, const thread_metadata &tmdata) |
Serialize a thread_metadata object to json. More... | |
void | to_json (nlohmann::json &j, const permission_overwrite &po) |
Serialize a permission_overwrite object to json. 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... | |
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... | |
std::string DPP_EXPORT | string_not_null (const nlohmann::json *j, const char *keyname) |
Returns a string from a json field value, if defined, else returns an empty string. More... | |
void DPP_EXPORT | set_string_not_null (const nlohmann::json *j, const char *keyname, std::string &v) |
Sets a string from a json field value, if defined, else does nothing. More... | |
double DPP_EXPORT | double_not_null (const nlohmann::json *j, const char *keyname) |
Returns a double from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_double_not_null (const nlohmann::json *j, const char *keyname, double &v) |
Sets a double from a json field value, if defined, else does nothing. More... | |
uint64_t DPP_EXPORT | int64_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. DO NOT use this for snowflakes, as usually snowflakes are wrapped in a string! More... | |
void DPP_EXPORT | set_int64_not_null (const nlohmann::json *j, const char *keyname, uint64_t &v) |
Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing. More... | |
uint32_t DPP_EXPORT | int32_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int32_not_null (const nlohmann::json *j, const char *keyname, uint32_t &v) |
Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing. More... | |
uint16_t DPP_EXPORT | int16_not_null (const nlohmann::json *j, const char *keyname) |
Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int16_not_null (const nlohmann::json *j, const char *keyname, uint16_t &v) |
Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing. More... | |
uint8_t DPP_EXPORT | int8_not_null (const nlohmann::json *j, const char *keyname) |
Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0. More... | |
void DPP_EXPORT | set_int8_not_null (const nlohmann::json *j, const char *keyname, uint8_t &v) |
Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing. More... | |
bool DPP_EXPORT | bool_not_null (const nlohmann::json *j, const char *keyname) |
Returns a boolean value from a json field value, if defined, else returns false. More... | |
void DPP_EXPORT | set_bool_not_null (const nlohmann::json *j, const char *keyname, bool &v) |
Sets a boolean from a json field value, if defined, else does nothing. More... | |
time_t DPP_EXPORT | ts_not_null (const nlohmann::json *j, const char *keyname) |
Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns epoch value of 0. More... | |
void DPP_EXPORT | set_ts_not_null (const nlohmann::json *j, const char *keyname, time_t &v) |
Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing. More... | |
std::string DPP_EXPORT | base64_encode (unsigned char const *buf, unsigned int buffer_length) |
Base64 encode data into a string. More... | |
std::string DPP_EXPORT | ts_to_string (time_t ts) |
Convert time_t unix epoch to std::string ISO date/time. More... | |
const dns_cache_entry * | resolve_hostname (const std::string &hostname, const std::string &port) |
Resolve a hostname to an addrinfo. More... | |
void | from_json (const nlohmann::json &j, guild_member &gm) |
helper function to deserialize a guild_member from json More... | |
guild_member DPP_EXPORT | find_guild_member (const snowflake guild_id, const snowflake user_id) |
Get the guild_member from cache of given IDs. More... | |
template<typename T > | |
auto | run_once () |
Run some code within an if() statement only once. More... | |
template<class T > | |
void | rest_request (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing. More... | |
template<> | |
void | rest_request< message > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing (specialised for message) More... | |
template<> | |
void | rest_request< confirmation > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback) |
Templated REST request helper to save on typing (specialised for confirmation) More... | |
template<class T > | |
void | rest_request_list (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key="id") |
Templated REST request helper to save on typing (for returned lists) More... | |
template<> | |
void | rest_request_list< invite > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for invites) More... | |
template<> | |
void | rest_request_list< voiceregion > (dpp::cluster *c, const char *basepath, const std::string &major, const std::string &minor, http_method method, const std::string &postdata, command_completion_event_t callback, const std::string &key) |
Templated REST request helper to save on typing (for returned lists, specialised for voiceregions) More... | |
bool | close_socket (dpp::socket sfd) |
Close a socket. More... | |
bool | set_nonblocking (dpp::socket sockfd, bool non_blocking) |
Set a socket to blocking or non-blocking IO. More... | |
template<typename T > | |
std::basic_string< T > | lowercase (const std::basic_string< T > &s) |
Convert a string to lowercase using tolower() More... | |
template<typename T > | |
std::basic_string< T > | uppercase (const std::basic_string< T > &s) |
Convert a string to uppercase using toupper() More... | |
std::string | rtrim (std::string s) |
trim from end of string (right) More... | |
std::string | ltrim (std::string s) |
trim from beginning of string (left) More... | |
std::string | trim (std::string s) |
Trim from both ends of string (right then left) More... | |
template<class T > | |
std::string | comma (T value) |
Add commas to a string (or dots) based on current locale server-side. More... | |
template<typename T > | |
T | from_string (const std::string &s, std::ios_base &(*f)(std::ios_base &)) |
Convert any value from a string to another type using stringstream. The optional second parameter indicates the format of the input string, e.g. std::dec for decimal, std::hex for hex, std::oct for octal. More... | |
template<typename T > | |
T | from_string (const std::string &s) |
Convert any value from a string to another type using stringstream. More... | |
template<uint64_t > | |
uint64_t | from_string (const std::string &s) |
Specialised conversion of uint64_t from string. More... | |
template<uint32_t > | |
uint32_t | from_string (const std::string &s) |
Specialised conversion of uint32_t from string. More... | |
template<int > | |
int | from_string (const std::string &s) |
Specialised conversion of int from string. More... | |
template<typename T > | |
std::string | to_hex (T i) |
Convert a numeric value to hex. More... | |
template<typename T > | |
std::string | leading_zeroes (T i, size_t width) |
Format a numeric type as a string with leading zeroes. More... | |
template<typename T , class F , class... Ts> | |
T | sync (class cluster *c, F func, Ts &&... args) |
Call a D++ REST function synchronously. More... | |
void | from_json (const nlohmann::json &j, user &u) |
helper function to deserialize a user from json More... | |
void | from_json (const nlohmann::json &j, user_identified &u) |
helper function to deserialize a user_identified from json More... | |
Variables | |
DPP_EXPORT std::unordered_map< managed *, time_t > | deletion_queue |
DPP_EXPORT std::mutex | deletion_mutex |
DPP_EXPORT event_handle | _next_handle |
const uint8_t | FORMAT_VERSION = 131 |
static version_checker | dpp_vc |
The main namespace for D++ functions. classes and types.
The main namespace for D++ functions, classes and types.
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::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
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 for co_number and co_integer dpp::command_option types.
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 above. It is used in interactions.
std::monostate indicates an invalid parameter value, e.g. an unfilled optional parameter.
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 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
using dpp::handle_type = typedef std::coroutine_handle<struct promise> |
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 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, slashcommand> dpp::slashcommand_map |
A group of application slash commands.
typedef uint64_t dpp::snowflake |
A 64 bit unsigned value representing many things on discord. Discord calls the value a 'snowflake' value.
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.
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::audit_type |
Defines types of audit log entry.
enum dpp::automod_action_type : uint8_t |
enum dpp::automod_event_type : uint8_t |
enum dpp::automod_preset_type : uint8_t |
enum dpp::automod_trigger_type : uint8_t |
Represents the caching policy of a cache in the library.
enum dpp::channel_flags : uint8_t |
Our flags as stored in the object.
enum dpp::channel_type : uint8_t |
Flag integers as received from and sent to discord.
Enumerator | |
---|---|
CHANNEL_TEXT | a text channel within a server |
DM | a direct message between users |
CHANNEL_VOICE | a voice channel within a server |
GROUP_DM | a direct message between multiple users
|
CHANNEL_CATEGORY | an organizational category that contains up to 50 channels |
CHANNEL_NEWS | a channel that users can follow and crosspost into their own server |
CHANNEL_STORE | a channel in which game developers can sell their game on Discord
|
CHANNEL_NEWS_THREAD | a temporary sub-channel within a GUILD_NEWS channel |
CHANNEL_PUBLIC_THREAD | a temporary sub-channel within a GUILD_TEXT channel |
CHANNEL_PRIVATE_THREAD | a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission |
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, coming soon(tm) |
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_style : uint8_t |
enum dpp::component_type : uint8_t |
enum dpp::discord_channel_flags : uint8_t |
The flags in discord channel's raw "flags" field. We use these for serialisation only, right now. Might be better to create a new field than to make the existing channel::flags from uint8_t to uint16_t, if discord adds more flags in future.
Enumerator | |
---|---|
dc_pinned_thread | Thread pinned in a forum (type 15) channel. |
enum dpp::emoji_flags : uint8_t |
Flags for dpp::emoji.
Enumerator | |
---|---|
e_require_colons | Emoji requires colons. |
e_managed | Managed (introduced by application) |
e_animated | Animated. |
e_available | Available (false if the guild doesn't meet boosting criteria, etc) |
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 |
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_commerce | Guild has commerce features enabled
|
g_news | Guild has news features enabled |
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_private_threads | guild has access to create private threads |
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 : uint8_t |
enum dpp::guild_member_flags : uint8_t |
Various flags that can be used to indicate the status of a 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::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 |
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.
Response types when responding to an interaction within on_interaction_create. Do not use ir_acknowledge or ir::channel_message, as these are deprecated in the Discord API spec. They are listed in this enum for completeness.
Types of interaction in the dpp::interaction class
enum dpp::loglevel |
enum dpp::message_flags |
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::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.
Enumerator | |
---|---|
pt_string | String value. |
pt_role | Role object. |
pt_channel | Channel object. |
pt_user | User object. |
pt_integer | 64 bit signed integer |
pt_double | double floating point |
pt_boolean | boolean |
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
Enumerator | |
---|---|
r_hoist | Hoisted role. |
r_managed | Managed role (introduced by a bot or application) |
r_mentionable | Mentionable with a ping. |
r_premium_subscriber | This is set for the role given to nitro. |
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_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 |
enum dpp::webhook_type |
enum dpp::websocket_protocol_t : uint8_t |
enum dpp::ws_opcode : uint8_t |
enum dpp::ws_state : uint8_t |
Websocket connection status.
std::string DPP_EXPORT dpp::base64_encode | ( | unsigned char const * | buf, |
unsigned int | buffer_length | ||
) |
Base64 encode data into a string.
buf | Raw binary buffer |
buffer_length | Buffer length to encode |
bool DPP_EXPORT dpp::bool_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a boolean value from a json field value, if defined, else returns false.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
bool dpp::close_socket | ( | dpp::socket | sfd | ) |
Close a socket.
sfd | Socket to close |
std::string dpp::comma | ( | T | value | ) |
Add commas to a string (or dots) based on current locale server-side.
T | type of numeric value |
value | Value |
double DPP_EXPORT dpp::double_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a double from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
guild_member DPP_EXPORT dpp::find_guild_member | ( | const snowflake | guild_id, |
const snowflake | user_id | ||
) |
Get the guild_member from cache of given IDs.
guild_id | ID of the guild to find guild_member for |
user_id | ID of the user to find guild_member for |
dpp::cache_exception | if the guild or guild_member is not found in the cache |
void dpp::from_json | ( | const nlohmann::json & | j, |
autocomplete_interaction & | ai | ||
) |
helper function to deserialize an autocomplete_interaction from json
j | output json object |
ai | autocomplete_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
command_data_option & | cdo | ||
) |
helper function to deserialize a command_data_option from json
j | output json object |
cdo | command_data_option to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
command_interaction & | ci | ||
) |
helper function to deserialize a command_interaction from json
j | output json object |
ci | command_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
component_interaction & | bi | ||
) |
helper function to deserialize a component_interaction from json
j | output json object |
bi | button_interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
guild_member & | gm | ||
) |
helper function to deserialize a guild_member from json
j | output json object |
gm | guild_member to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
interaction & | i | ||
) |
helper function to deserialize an interaction from json
j | output json object |
i | interaction to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
user & | u | ||
) |
helper function to deserialize a user from json
j | output json object |
u | user to be deserialized |
void dpp::from_json | ( | const nlohmann::json & | j, |
user_identified & | u | ||
) |
helper function to deserialize a user_identified from json
j | output json object |
u | user to be deserialized |
T dpp::from_string | ( | const std::string & | s | ) |
Convert any value from a string to another type using stringstream.
T | Type to convert to |
s | String to convert from |
uint64_t dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of uint64_t from string.
int64_t |
s | string to convert |
uint32_t dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of uint32_t from string.
uint32_t |
s | string to convert |
int dpp::from_string | ( | const std::string & | s | ) |
Specialised conversion of int from string.
int |
s | string to convert |
T dpp::from_string | ( | const std::string & | s, |
std::ios_base &(*)(std::ios_base &) | f | ||
) |
Convert any value from a string to another type using stringstream. The optional second parameter indicates the format of the input string, e.g. std::dec for decimal, std::hex for hex, std::oct for octal.
T | Type to convert to |
s | String to convert from |
f | Numeric base, e.g. std::dec or std::hex |
void DPP_EXPORT dpp::garbage_collection | ( | ) |
Run garbage collection across all caches removing deleted items that have been deleted over 60 seconds ago.
DPP_EXPORT uint64_t dpp::get_channel_count | ( | ) |
DPP_EXPORT uint64_t dpp::get_emoji_count | ( | ) |
DPP_EXPORT uint64_t dpp::get_guild_count | ( | ) |
DPP_EXPORT uint64_t dpp::get_role_count | ( | ) |
DPP_EXPORT uint64_t dpp::get_user_count | ( | ) |
uint16_t DPP_EXPORT dpp::int16_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint32_t DPP_EXPORT dpp::int32_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint64_t DPP_EXPORT dpp::int64_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a 64 bit unsigned integer from a json field value, if defined, else returns 0. DO NOT use this for snowflakes, as usually snowflakes are wrapped in a string!
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
uint8_t DPP_EXPORT dpp::int8_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string dpp::leading_zeroes | ( | T | i, |
size_t | width | ||
) |
Format a numeric type as a string with leading zeroes.
T | numeric type |
i | numeric value |
width | width of type including the leading zeroes |
std::basic_string< T > dpp::lowercase | ( | const std::basic_string< T > & | s | ) |
Convert a string to lowercase using tolower()
T | type of string |
s | String to lowercase |
|
inline |
trim from beginning of string (left)
s | string to trim |
const dns_cache_entry * dpp::resolve_hostname | ( | const std::string & | hostname, |
const std::string & | port | ||
) |
Resolve a hostname to an addrinfo.
hostname | Hostname to resolve |
port | A port number or named service, e.g. "80" |
dpp::connection_exception | On failure to resolve hostname |
|
inline |
Templated REST request helper to save on typing.
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (specialised for confirmation)
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (specialised for message)
T | type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
callback | Callback lambda |
|
inline |
Templated REST request helper to save on typing (for returned lists)
T | singular type to return in lambda callback |
T | map type to return in lambda callback |
c | calling cluster |
basepath | base path for API call |
major | major API function |
minor | minor API function |
method | HTTP method |
postdata | Post data or empty string |
key | Key name of elements in the json list |
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 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 |
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_EXPORT dpp::set_bool_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
bool & | v | ||
) |
Sets a boolean from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_double_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
double & | v | ||
) |
Sets a double from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int16_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint16_t & | v | ||
) |
Sets an unsigned 16 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int32_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint32_t & | v | ||
) |
Sets an unsigned 32 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int64_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint64_t & | v | ||
) |
Sets an unsigned 64 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_int8_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint8_t & | v | ||
) |
Sets an unsigned 8 bit integer from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
bool dpp::set_nonblocking | ( | dpp::socket | sockfd, |
bool | non_blocking | ||
) |
Set a socket to blocking or non-blocking IO.
sockfd | socket to act upon |
void DPP_EXPORT dpp::set_snowflake_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
uint64_t & | v | ||
) |
Sets a snowflake id from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_string_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
std::string & | v | ||
) |
Sets a string from a json field value, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
void DPP_EXPORT dpp::set_ts_not_null | ( | const nlohmann::json * | j, |
const char * | keyname, | ||
time_t & | v | ||
) |
Sets an timestamp from a json field value containing an ISO8601 string, if defined, else does nothing.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
v | Value to change |
uint64_t DPP_EXPORT dpp::snowflake_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a snowflake id from a json field value, if defined, else returns 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string DPP_EXPORT dpp::string_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a string from a json field value, if defined, else returns an empty string.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
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 | ) |
Convert a numeric value to hex.
T | numeric type |
i | numeric value |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_option & | opt | ||
) |
helper function to serialize a command_option to json
j | output json object |
opt | command_option to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_option_choice & | choice | ||
) |
helper function to serialize a command_option_choice to json
j | output json object |
choice | command_option_choice to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const command_permission & | cp | ||
) |
helper function to serialize a command_permission to json
j | output json object |
cp | command_permission to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const guild_command_permissions & | gcp | ||
) |
helper function to serialize a guild_command_permissions to json
j | output json object |
gcp | guild_command_permissions to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const permission_overwrite & | po | ||
) |
Serialize a permission_overwrite object to json.
j | JSON object to serialize to |
po | object to serialize |
void dpp::to_json | ( | nlohmann::json & | j, |
const slashcommand & | cmd | ||
) |
helper function to serialize a slashcommand to json
j | output json object |
cmd | slashcommand to be serialized |
void dpp::to_json | ( | nlohmann::json & | j, |
const thread_metadata & | tmdata | ||
) |
Serialize a thread_metadata object to json.
j | JSON object to serialize to |
tmdata | object to serialize |
|
inline |
Trim from both ends of string (right then left)
s | string to trim |
time_t DPP_EXPORT dpp::ts_not_null | ( | const nlohmann::json * | j, |
const char * | keyname | ||
) |
Returns a time_t from an ISO8601 timestamp field in a json value, if defined, else returns epoch value of 0.
j | nlohmann::json instance to retrieve value from |
keyname | key name to check for a value |
std::string DPP_EXPORT dpp::ts_to_string | ( | time_t | ts | ) |
Convert time_t unix epoch to std::string ISO date/time.
ts | Timestamp to convert |
std::basic_string< T > dpp::uppercase | ( | const std::basic_string< T > & | s | ) |
Convert a string to uppercase using toupper()
T | type of string |
s | String to uppercase |
|
extern |
|
extern |
|
extern |
|
static |
const uint8_t dpp::FORMAT_VERSION = 131 |
Current ETF format version in use