D++ (DPP)
C++ Discord API Bot Library
dpp Namespace Reference

The main namespace for D++ functions. classes and types. More...

Namespaces

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.
 

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  application_command_create_t
 Create application slash command. More...
 
struct  application_command_delete_t
 
struct  application_command_update_t
 Update application slash command. 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 entry of a guild. More...
 
class  ban
 The ban class represents a ban on a guild. More...
 
struct  bucket_t
 
struct  button_click_t
 Click on button. More...
 
class  cache
 A cache object maintains a cache of dpp::managed objects. This is for example users, channels or guilds. More...
 
struct  cache_policy_t
 Represents the caching policy of the cluster. More...
 
class  channel
 A definition of a discord channel. 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...
 
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 usernames. TODO: Needs implementation. Not needed something that functions as we have cache. 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  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...
 
class  dispatcher
 The dispatcher class contains a set of std::functions representing hooked events that the user code is interested in. These are modified via the on_eventname style methods in the cluster class. 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  event_dispatch_t
 Base event parameter struct. More...
 
struct  gateway
 Represents the various information from the 'get gateway bot' api call. More...
 
class  guild
 Represents a guild on Discord (AKA a server) More...
 
struct  guild_ban_add_t
 Guild ban add. More...
 
struct  guild_ban_remove_t
 Guild ban remove. More...
 
class  guild_command_permissions
 Returned when fetching the permissions for a command in a guild. More...
 
struct  guild_create_t
 Create guild. More...
 
struct  guild_delete_t
 Delete guild. More...
 
struct  guild_emojis_update_t
 Guild emojis update. More...
 
struct  guild_integrations_update_t
 Guild integrations update. More...
 
struct  guild_join_request_delete_t
 Guild join request delete (user declined membership screening) More...
 
class  guild_member
 Represents dpp::user membership upon a dpp::guild. More...
 
struct  guild_member_add_t
 Guild member add. More...
 
struct  guild_member_remove_t
 Guild member remove. More...
 
struct  guild_member_update_t
 Guild member update. More...
 
struct  guild_members_chunk_t
 Guild members chunk. More...
 
struct  guild_role_create_t
 Guild role create. More...
 
struct  guild_role_delete_t
 Guild role delete. More...
 
struct  guild_role_update_t
 Guild role update. More...
 
struct  guild_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...
 
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  integration
 
struct  integration_app
 An application that has been integrated. More...
 
struct  integration_create_t
 Integration create. More...
 
struct  integration_delete_t
 Integration delete. More...
 
struct  integration_update_t
 Integration update. More...
 
class  interaction
 An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event. More...
 
struct  interaction_create_t
 Create interaction. More...
 
struct  interaction_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  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  log_t
 Log messages. 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...
 
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  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...
 
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  prune
 Defines a request to count prunable users, or start a prune operation. More...
 
struct  reaction
 Represets a reaction to a dpp::message. 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  resumed_t
 Session resumed. More...
 
class  role
 Represents a role within a dpp::guild. More...
 
struct  select_click_t
 Click on select. More...
 
struct  select_option
 
class  slashcommand
 Represents an application command, created by your bot either globally, or on a guild. More...
 
class  ssl_client
 Implements a simple non-blocking SSL stream client. More...
 
struct  stage_instance_create_t
 Create stage instance. More...
 
struct  stage_instance_delete_t
 Delete stage instance. More...
 
struct  sticker
 Represents stickers received in messages. More...
 
struct  sticker_pack
 
struct  thread_create_t
 Thread Create. More...
 
struct  thread_delete_t
 
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...
 
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_update_t
 
struct  voice_buffer_send_t
 voice buffer send 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...
 

Typedefs

typedef std::unordered_map< snowflake, banban_map
 
typedef std::unordered_map< uint64_t, managed * > cache_container
 A set of cached managed objects. More...
 
typedef std::unordered_map< snowflake, thread_memberthread_member_map
 A group of thread member objects. More...
 
typedef std::unordered_map< snowflake, channelchannel_map
 A group of channels. 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_map, guild_member, guild_member_map, channel, channel_map, thread_member_map, guild, guild_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, sticker, sticker_map, sticker_pack, sticker_pack_mapconfirmable_t
 A container for types that can be returned for a REST API call. More...
 
typedef std::function< void(const confirmation_callback_t &)> command_completion_event_t
 A callback upon command completion. More...
 
typedef std::function< void(json &, const http_request_completion_t &)> json_encode_t
 Automatically JSON encoded HTTP result. More...
 
typedef std::variant< std::string, dpp::role, dpp::channel, dpp::user, int32_t, bool > 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 doesnt 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 explaination 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...
 
typedef uint64_t snowflake
 A 64 bit unsigned value representing many things on discord. Discord calls the value a 'snowflake' value. More...
 
typedef std::unordered_map< snowflake, dtemplatedtemplate_map
 
typedef std::unordered_map< snowflake, emojiemoji_map
 Group of emojis. More...
 
typedef std::unordered_map< snowflake, guild_membermembers_container
 Guild members container. More...
 
typedef std::unordered_map< snowflake, guildguild_map
 
typedef std::unordered_map< snowflake, guild_memberguild_member_map
 
typedef std::unordered_map< snowflake, integrationintegration_map
 
typedef std::unordered_map< std::string, inviteinvite_map
 
typedef std::unordered_map< snowflake, messagemessage_map
 
typedef std::unordered_map< snowflake, stickersticker_map
 
typedef std::unordered_map< snowflake, sticker_packsticker_pack_map
 
typedef std::unordered_map< std::string, presencepresence_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::unordered_map< snowflake, rolerole_map
 
typedef std::variant< std::string, int32_t, bool, snowflakecommand_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::unordered_map< snowflake, slashcommandslashcommand_map
 A group of application slash commands. More...
 
typedef std::unordered_map< snowflake, useruser_map
 
typedef std::unordered_map< std::string, voiceregionvoiceregion_map
 A group of voice regions. More...
 
typedef std::unordered_map< std::string, voicestatevoicestate_map
 
typedef std::unordered_map< snowflake, webhookwebhook_map
 A group of webhooks. More...
 

Enumerations

enum  audit_type {
  ae_guild_update = 1 , ae_channel_create = 10 , ae_channel_update = 11 , ae_channel_delete = 12 ,
  ae_channel_overwrite_create = 13 , ae_channel_overwrite_update = 14 , ae_channel_overwrite_delete = 15 , ae_member_kick = 20 ,
  ae_member_prune = 21 , ae_member_ban_add = 22 , ae_member_ban_remove = 23 , ae_member_update = 24 ,
  ae_member_role_update = 25 , ae_member_move = 26 , ae_member_disconnect = 27 , ae_bot_add = 28 ,
  ae_role_create = 30 , ae_role_update = 31 , ae_role_delete = 32 , ae_invite_create = 40 ,
  ae_invite_update = 41 , ae_invite_delete = 42 , ae_webhook_create = 50 , ae_webhook_update = 51 ,
  ae_webhook_delete = 52 , ae_emoji_create = 60 , ae_emoji_update = 61 , ae_emoji_delete = 62 ,
  ae_message_delete = 72 , ae_message_bulk_delete = 73 , ae_message_pin = 74 , ae_message_unpin = 75 ,
  ae_integration_create = 80 , ae_integration_update = 81 , ae_integration_delete = 82
}
 Defines types of audit log entry. More...
 
enum  channel_type {
  GUILD_TEXT = 0 , DM = 1 , GUILD_VOICE = 2 , GROUP_DM = 3 ,
  GUILD_CATEGORY = 4 , GUILD_NEWS = 5 , GUILD_STORE = 6 , GUILD_NEWS_THREAD = 10 ,
  GUILD_PUBLIC_THREAD = 11 , GUILD_PRIVATE_THREAD = 12 , GUILD_STAGE = 13
}
 Flag integers as received from and sent to discord. More...
 
enum  channel_flags {
  c_nsfw = 0b00000001 , c_text = 0b00000010 , c_dm = 0b00000100 , c_voice = 0b00001000 ,
  c_group = 0b00010000 , c_category = 0b00100000 , c_news = 0b01000000 , c_store = 0b10000000 ,
  c_stage = 0b11000000 , c_news_thread = 0b11100000 , c_public_thread = 0b11110000 , c_private_thread = 0b11111000
}
 Our flags as stored in the object. More...
 
enum  overwrite_type : uint8_t { ot_role = 0 , ot_member = 1 }
 channel permission overwrite types More...
 
enum  parameter_type {
  pt_string , pt_role , pt_channel , pt_user ,
  pt_integer , 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  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  emoji_flags { e_require_colons = 0b00000001 , e_managed = 0b00000010 , e_animated = 0b00000100 , e_available = 0b00001000 }
 Flags for dpp::emoji. 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 {
  g_large = 0b000000000000000000001 , g_unavailable = 0b000000000000000000010 , g_widget_enabled = 0b000000000000000000100 , g_invite_splash = 0b000000000000000001000 ,
  g_vip_regions = 0b000000000000000010000 , g_vanity_url = 0b000000000000000100000 , g_verified = 0b000000000000001000000 , g_partnered = 0b000000000000010000000 ,
  g_community = 0b000000000000100000000 , g_commerce = 0b000000000001000000000 , g_news = 0b000000000010000000000 , g_discoverable = 0b000000000100000000000 ,
  g_featureable = 0b000000001000000000000 , g_animated_icon = 0b000000010000000000000 , g_banner = 0b000000100000000000000 , g_welcome_screen_enabled = 0b000001000000000000000 ,
  g_member_verification_gate = 0b000010000000000000000 , g_preview_enabled = 0b000100000000000000000 , g_no_join_notifications = 0b001000000000000000000 , g_no_boost_notifications = 0b010000000000000000000 ,
  g_has_animated_icon = 0b100000000000000000000
}
 The various flags that represent the status of a dpp::guild object. More...
 
enum  guild_member_flags { gm_deaf = 0b00001 , gm_mute = 0b00010 , gm_pending = 0b00100 }
 Various flags that can be used to indicate the status of a guild member. 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_default_intents = dpp::i_guilds | dpp::i_guild_bans | dpp::i_guild_emojis | dpp::i_guild_integrations | dpp::i_guild_webhooks | dpp::i_guild_invites | dpp::i_guild_voice_states | dpp::i_guild_messages | dpp::i_guild_message_reactions | dpp::i_guild_message_typing | dpp::i_direct_messages | dpp::i_direct_message_typing | dpp::i_direct_message_reactions ,
  i_privileged_intents = dpp::i_guild_members | dpp::i_guild_presences , 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 }
 Represents the type of a component. 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 }
 
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_supress_embeds = 1 << 2 , m_source_message_deleted = 1 << 3 ,
  m_urgent = 1 << 4 , 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
}
 Mesage types for dpp::message::type. More...
 
enum  cache_policy_setting_t { cp_aggressive = 0 , cp_lazy = 1 , cp_none = 2 }
 
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_custom = 3 ,
  at_competing = 4
}
 Game types. More...
 
enum  activity_flags {
  af_instance = 0b00000001 , af_join = 0b00000010 , af_spectate = 0b00000100 , af_join_request = 0b00001000 ,
  af_sync = 0b00010000 , af_play = 0b00100000
}
 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
}
 
enum  http_method {
  m_get , m_post , m_put , m_patch ,
  m_delete
}
 
enum  role_flags { r_hoist = 0b00000001 , r_managed = 0b00000010 , r_mentionable = 0b00000100 , r_premium_subscriber = 0b00001000 }
 
enum  role_permissions : uint64_t {
  p_create_instant_invite = 0x00000001 , p_kick_members = 0x00000002 , p_ban_members = 0x00000004 , p_administrator = 0x00000008 ,
  p_manage_channels = 0x00000010 , p_manage_guild = 0x00000020 , p_add_reactions = 0x00000040 , p_view_audit_log = 0x00000080 ,
  p_priority_speaker = 0x00000100 , p_stream = 0x00000200 , p_view_channel = 0x00000400 , p_send_messages = 0x00000800 ,
  p_send_tts_messages = 0x00001000 , p_manage_messages = 0x00002000 , p_embed_links = 0x00004000 , p_attach_files = 0x0000008000 ,
  p_read_message_history = 0x0000010000 , p_mention_everyone = 0x0000020000 , p_use_external_emojis = 0x0000040000 , p_view_guild_insights = 0x0000080000 ,
  p_connect = 0x0000100000 , p_speak = 0x0000200000 , p_mute_members = 0x0000400000 , p_deafen_members = 0x0000800000 ,
  p_move_members = 0x0001000000 , p_use_vad = 0x0002000000 , p_change_nickname = 0x0004000000 , p_manage_nicknames = 0x0008000000 ,
  p_manage_roles = 0x0010000000 , p_manage_webhooks = 0x0020000000 , p_manage_emojis = 0x0040000000 , p_use_slash_commands = 0x0080000000 ,
  p_request_to_speak = 0x0100000000 , p_manage_threads = 0x0400000000 , p_use_public_threads = 0x0800000000 , p_use_private_threads = 0x1000000000
}
 Represents the various discord permissions. More...
 
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
}
 Represents command option types. These are the possible parameter value types. More...
 
enum  interaction_response_type {
  ir_pong = 1 , ir_acknowledge = 2 , ir_channel_message = 3 , ir_channel_message_with_source = 4 ,
  ir_deferred_channel_message_with_source = 5 , ir_deferred_update_message = 6 , ir_update_message = 7
}
 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 }
 
enum  component_type_t { cotype_button = 2 , cotype_select = 3 }
 
enum  command_permission_type { cpt_role = 1 , cpt_user = 2 }
 type of permission in the dpp::command_permission class More...
 
enum  slashcommand_contextmenu_type { ctxm_none = 0 , ctxm_chat_input = 1 , ctxm_user = 2 , ctxm_message = 3 }
 
enum  user_flags {
  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_balanace = 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
}
 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_supress = 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  ws_state { HTTP_HEADERS , CONNECTED }
 Websocket connection status. More...
 
enum  ws_opcode {
  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 garbage_collection ()
 
userfind_user (snowflake id)
 
cacheget_user_cache ()
 
uint64_t get_user_count ()
 
guildfind_guild (snowflake id)
 
cacheget_guild_cache ()
 
uint64_t get_guild_count ()
 
rolefind_role (snowflake id)
 
cacheget_role_cache ()
 
uint64_t get_role_count ()
 
channelfind_channel (snowflake id)
 
cacheget_channel_cache ()
 
uint64_t get_channel_count ()
 
emojifind_emoji (snowflake id)
 
cacheget_emoji_cache ()
 
uint64_t get_emoji_count ()
 
uint64_t SnowflakeNotNull (const nlohmann::json *j, const char *keyname)
 Returns a snowflake id from a json field value, if defined, else returns 0. More...
 
void SetSnowflakeNotNull (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 StringNotNull (const nlohmann::json *j, const char *keyname)
 Returns a string from a json field value, if defined, else returns an empty string. More...
 
void SetStringNotNull (const nlohmann::json *j, const char *keyname, std::string &v)
 Sets a string from a json field value, if defined, else does nothing. More...
 
uint64_t Int64NotNull (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 SetInt64NotNull (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 Int32NotNull (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 SetInt32NotNull (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 Int16NotNull (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 SetInt16NotNull (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 Int8NotNull (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 SetInt8NotNull (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 BoolNotNull (const nlohmann::json *j, const char *keyname)
 Returns a boolean value from a json field value, if defined, else returns false. More...
 
void SetBoolNotNull (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 TimestampNotNull (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 SetTimestampNotNull (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 base64_encode (unsigned char const *buf, unsigned int buffer_length)
 Base64 encode data into a string. More...
 
void from_json (const nlohmann::json &j, guild_member &gm)
 helper function to deserialize a guild_member from json More...
 
std::string url_encode (const std::string &value)
 
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, 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 from_json (const nlohmann::json &j, user &u)
 helper function to deserialize a user from json More...
 

Detailed Description

The main namespace for D++ functions. classes and types.

Typedef Documentation

◆ ban_map

typedef std::unordered_map<snowflake, ban> dpp::ban_map

A group of bans

◆ cache_container

typedef std::unordered_map<uint64_t, managed*> dpp::cache_container

A set of cached managed objects.

◆ channel_map

typedef std::unordered_map<snowflake, channel> dpp::channel_map

A group of channels.

◆ command_completion_event_t

typedef std::function<void(const confirmation_callback_t&)> dpp::command_completion_event_t

A callback upon command completion.

◆ command_handler

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.

◆ command_parameter

typedef std::variant<std::string, dpp::role, dpp::channel, dpp::user, int32_t, bool> dpp::command_parameter

Represents a received parameter. We use variant so that multiple non-related types can be contained within.

◆ command_value

typedef std::variant<std::string, int32_t, bool, snowflake> 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.

◆ confirmable_t

◆ dtemplate_map

typedef std::unordered_map<snowflake, dtemplate> dpp::dtemplate_map

A container of invites

◆ emoji_map

typedef std::unordered_map<snowflake, emoji> dpp::emoji_map

Group of emojis.

◆ guild_map

typedef std::unordered_map<snowflake, guild> dpp::guild_map

A container of guilds

◆ guild_member_map

typedef std::unordered_map<snowflake, guild_member> dpp::guild_member_map

A container of guild members

◆ http_completion_event

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.

Note
Returned http_completion_events are called ASYNCRONOUSLY in your code which means they execute in a separate thread. The completion events arrive in order.

◆ integration_map

typedef std::unordered_map<snowflake, integration> dpp::integration_map

A group of integrations

◆ invite_map

typedef std::unordered_map<std::string, invite> dpp::invite_map

A container of invites

◆ json_encode_t

typedef std::function<void(json&, const http_request_completion_t&)> dpp::json_encode_t

Automatically JSON encoded HTTP result.

◆ members_container

typedef std::unordered_map<snowflake, guild_member> dpp::members_container

Guild members container.

◆ message_map

typedef std::unordered_map<snowflake, message> dpp::message_map

A group of messages

◆ parameter_list_t

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 explaination as to why vector is used.

◆ parameter_registration_t

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 doesnt guarantee any order at all) and std::map, which reorders keys alphabetically.

◆ presence_map

typedef std::unordered_map<std::string, presence> dpp::presence_map

A container of presences

◆ role_map

typedef std::unordered_map<snowflake, role> dpp::role_map

A group of roles

◆ shard_list

typedef std::map<uint32_t, class discord_client*> dpp::shard_list

A list of shards.

◆ slashcommand_map

typedef std::unordered_map<snowflake, slashcommand> dpp::slashcommand_map

A group of application slash commands.

◆ snowflake

typedef uint64_t dpp::snowflake

A 64 bit unsigned value representing many things on discord. Discord calls the value a 'snowflake' value.

◆ sticker_map

typedef std::unordered_map<snowflake, sticker> dpp::sticker_map

A group of stickers

◆ sticker_pack_map

typedef std::unordered_map<snowflake, sticker_pack> dpp::sticker_pack_map

A group of sticker packs

◆ thread_member_map

typedef std::unordered_map<snowflake, thread_member> dpp::thread_member_map

A group of thread member objects.

◆ user_map

typedef std::unordered_map<snowflake, user> dpp::user_map

A group of users

◆ voiceregion_map

typedef std::unordered_map<std::string, voiceregion> dpp::voiceregion_map

A group of voice regions.

◆ voicestate_map

typedef std::unordered_map<std::string, voicestate> dpp::voicestate_map

A container of voicestates

◆ webhook_map

typedef std::unordered_map<snowflake, webhook> dpp::webhook_map

A group of webhooks.

Enumeration Type Documentation

◆ activity_flags

Activity types for rich presence.

Enumerator
af_instance 

In an instance.

af_join 

Joining.

af_spectate 

Spectating.

af_join_request 

Sending join request.

af_sync 

Synchronising.

af_play 

Playing.

◆ activity_type

enum dpp::activity_type : uint8_t

Game types.

Enumerator
at_game 

"Playing ..."

at_streaming 

"Streaming ..."

at_listening 

"Listening to..."

at_custom 

"Watching..."

at_competing 

"Competing in..."

◆ audit_type

Defines types of audit log entry.

Enumerator
ae_guild_update 

Guild update.

ae_channel_create 

Channel create.

ae_channel_update 

Channel update.

ae_channel_delete 

Channel delete.

ae_channel_overwrite_create 

Channel overwrite create.

ae_channel_overwrite_update 

Channel overwrite update.

ae_channel_overwrite_delete 

Channel overwrite delete.

ae_member_kick 

Channel member kick.

ae_member_prune 

Channel member prune.

ae_member_ban_add 

Channel member ban add.

ae_member_ban_remove 

Channel member ban remove.

ae_member_update 

Guild member update.

ae_member_role_update 

Guild member role update.

ae_member_move 

Guild member move.

ae_member_disconnect 

Guild member voice disconnect.

ae_bot_add 

Guild bot add.

ae_role_create 

Guild role create.

ae_role_update 

Guild role update.

ae_role_delete 

Guild role delete.

ae_invite_create 

Guild invite create.

ae_invite_update 

Guild invite update.

ae_invite_delete 

Guild invite delete.

ae_webhook_create 

Guild webhook create.

ae_webhook_update 

Guild webhook update.

ae_webhook_delete 

Guild webhook delete.

ae_emoji_create 

Guild emoji create.

ae_emoji_update 

Guild emoji update.

ae_emoji_delete 

Guild emoji delete.

ae_message_delete 

Guild message delete.

ae_message_bulk_delete 

Guild message bulk delete.

ae_message_pin 

Guild message pin.

ae_message_unpin 

Guild message unpin.

ae_integration_create 

Guild integration create.

ae_integration_update 

Guild integration update.

ae_integration_delete 

Guild integration delete.

◆ cache_policy_setting_t

Enumerator
cp_aggressive 

request aggressively on seeing new guilds, and also store missing data from messages. This is the default behaviour.

cp_lazy 

only cache when there is relavent activity, e.g. a message to the bot.

cp_none 

Don't cache anything. Fill details when we see them. (NOT IMPLEMENTED YET)

◆ channel_flags

Our flags as stored in the object.

Enumerator
c_nsfw 

NSFW Gated Channel.

c_text 

Text channel.

c_dm 

Direct Message.

c_voice 

Voice channel.

c_group 

Group.

c_category 

Category.

c_news 

News channel.

c_store 

Store page.

c_stage 

Stage channel.

c_news_thread 

News thread.

c_public_thread 

Public thread.

c_private_thread 

Private thread.

◆ channel_type

Flag integers as received from and sent to discord.

Enumerator
GUILD_TEXT 

a text channel within a server

DM 

a direct message between users

GUILD_VOICE 

a voice channel within a server

GROUP_DM 

a direct message between multiple users

GUILD_CATEGORY 

an organizational category that contains up to 50 channels

GUILD_NEWS 

a channel that users can follow and crosspost into their own server

GUILD_STORE 

a channel in which game developers can sell their game on Discord

GUILD_NEWS_THREAD 

a temporary sub-channel within a GUILD_NEWS channel

GUILD_PUBLIC_THREAD 

a temporary sub-channel within a GUILD_TEXT channel

GUILD_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

GUILD_STAGE 

a "stage" channel, like a voice channel with one authorised speaker

◆ command_option_type

enum dpp::command_option_type : uint8_t

Represents command option types. These are the possible parameter value types.

Enumerator
co_sub_command 

A sub-command

co_sub_command_group 

A sub-command group

co_string 

A string value

co_integer 

An integer value

co_boolean 

A boolean value

co_user 

A user snowflake id

co_channel 

A channel snowflake id

co_role 

A role snowflake id

◆ command_permission_type

type of permission in the dpp::command_permission class

Enumerator
cpt_role 
cpt_user 

◆ component_style

enum dpp::component_style : uint8_t

Represents the style of a button.

Enumerator
cos_primary 

Blurple.

cos_secondary 

Grey.

cos_success 

Green.

cos_danger 

Red.

cos_link 

An external hyperlink to a website.

◆ component_type

enum dpp::component_type : uint8_t

Represents the type of a component.

Enumerator
cot_action_row 

Action row, a container for other components.

cot_button 

Clickable button.

cot_selectmenu 

Select menu.

◆ component_type_t

Enumerator
cotype_button 
cotype_select 

◆ emoji_flags

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)

◆ guild_flags

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_')

◆ guild_member_flags

Various flags that can be used to indicate the status of a guild member.

Enumerator
gm_deaf 

Member deafened

gm_mute 

Member muted

gm_pending 

Member pending verification by membership screening

◆ http_error

Error values. Don't change the order or add extra values here, as they map onto the error values of cpp-httplib

Enumerator
h_success 

Request successful.

h_unknown 

Status unknown.

h_connection 

Connect failed.

h_bind_ip_address 

Invalid local ip address.

h_read 

Read error.

h_write 

Write error.

h_exceed_redirect_count 

Too many 30x redirects.

h_canceled 

Request cancelled.

h_ssl_connection 

SSL connection error.

h_ssl_loading_certs 

SSL cert loading error.

h_ssl_server_verification 

SSL server verification error.

h_unsupported_multipart_boundary_chars 

Unsupported multipart boundary characters.

h_compression 

Compression error.

◆ http_method

Various types of http method supported by the Discord API

Enumerator
m_get 

GET.

m_post 

POST.

m_put 

PUT.

m_patch 

PATCH.

m_delete 

DELETE.

◆ image_type

Supported image types for profile pictures.

Enumerator
i_png 

image/png

i_jpg 

image/jpeg

i_gif 

image/gif

◆ integration_flags

Integration flags.

Enumerator
if_enabled 

Integration enabled.

if_syncing 

Integration synching.

if_emoticons 

Emoji integration.

if_revoked 

Integration revoked.

if_expire_kick 

Kick users when their subscription expires.

◆ integration_type

Integration types.

Enumerator
i_twitch 

Twitch integration.

i_youtube 

YouTube integration.

i_discord 

Discord integration.

◆ intents

intents are a bitmask of allowed events on your websocket.

Some of these are known as Privileged intents (GUILD_MEMBERS and GUILD_PRESENCES) and require verification of a bot over 100 servers by discord via submission of your real life ID.

Enumerator
i_guilds 

Intent for receipt of guild information.

i_guild_members 

Intent for receipt of guild members.

i_guild_bans 

Intent for receipt of guild bans.

i_guild_emojis 

Intent for receipt of guild emojis.

i_guild_integrations 

Intent for receipt of guild integrations.

i_guild_webhooks 

Intent for receipt of guild webhooks.

i_guild_invites 

Intent for receipt of guild invites.

i_guild_voice_states 

Intent for receipt of guild voice states.

i_guild_presences 

Intent for receipt of guild presences.

i_guild_messages 

Intent for receipt of guild messages.

i_guild_message_reactions 

Intent for receipt of guild message reactions.

i_guild_message_typing 

Intent for receipt of guild message typing notifications.

i_direct_messages 

Intent for receipt of direct messages (DMs)

i_direct_message_reactions 

Intent for receipt of direct message reactions.

i_direct_message_typing 

Intent for receipt of direct message typing notifications.

i_default_intents 

Default D++ intents (all non-privileged intents)

i_privileged_intents 
i_all_intents 

◆ interaction_response_type

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.

Enumerator
ir_pong 

ACK a Ping.

ir_acknowledge 

DEPRECATED ACK a command without sending a message, eating the user's input.

ir_channel_message 

DEPRECATED respond with a message, eating the user's input.

ir_channel_message_with_source 

respond to an interaction with a message

ir_deferred_channel_message_with_source 

ACK an interaction and edit a response later, the user sees a loading state.

ir_deferred_update_message 

for components, ACK an interaction and edit the original message later; the user does not see a loading state

ir_update_message 

for components, edit the message the component was attached to

◆ interaction_type

Types of interaction in the dpp::interaction class

Enumerator
it_ping 

ping

it_application_command 

application command (slash command)

it_component_button 

button click (component interaction)

◆ loglevel

Log levels.

Enumerator
ll_trace 

Trace.

ll_debug 

Debug.

ll_info 

Information.

ll_warning 

Warning.

ll_error 

Error.

ll_critical 

Critical.

◆ message_flags

Bitmask flags for a dpp::message.

Enumerator
m_crossposted 

this message has been published to subscribed channels (via Channel Following)

m_is_crosspost 

this message originated from a message in another channel (via Channel Following)

m_supress_embeds 

do not include any embeds when serializing this message

m_source_message_deleted 

the source message for this crosspost has been deleted (via Channel Following)

m_urgent 

this message came from the urgent message system

m_ephemeral 

this message is only visible to the user who invoked the Interaction

m_loading 

this message is an Interaction Response and the bot is "thinking"

◆ message_type

Mesage types for dpp::message::type.

Enumerator
mt_default 

Default.

mt_recipient_add 

Add recipient.

mt_recipient_remove 

Remove recipient.

mt_call 

Call.

mt_channel_name_change 

Channel name change.

mt_channel_icon_change 

Channel icon change.

mt_channel_pinned_message 

Message pinned.

mt_guild_member_join 

Member joined.

mt_user_premium_guild_subscription 

Boost.

mt_user_premium_guild_subscription_tier_1 

Boost level 1.

mt_user_premium_guild_subscription_tier_2 

Boost level 2.

mt_user_premium_guild_subscription_tier_3 

Boost level 3.

mt_channel_follow_add 

Follow channel.

mt_guild_discovery_disqualified 

Disqualified from discovery.

mt_guild_discovery_requalified 

Re-qualified for discovery.

mt_guild_discovery_grace_period_initial_warning 

Discovery grace period warning 1.

mt_guild_discovery_grace_period_final_warning 

Discovery grace period warning 2.

mt_thread_created 

Thread Created.

mt_reply 

Reply.

mt_application_command 

Application command.

mt_thread_starter_message 

Thread starter message.

mt_guild_invite_reminder 

Invite reminder.

◆ overwrite_type

enum dpp::overwrite_type : uint8_t

channel permission overwrite types

Enumerator
ot_role 

Role.

ot_member 

Member.

◆ 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 

32 bit signed integer

pt_boolean 

boolean

◆ presence_flags

Presence flags bitmask.

Enumerator
p_desktop_online 

Desktop: Online.

p_desktop_dnd 

Desktop: DND.

p_desktop_idle 

Desktop: Idle.

p_web_online 

Web: Online.

p_web_dnd 

Web: DND.

p_web_idle 

Web: Idle.

p_mobile_online 

Mobile: Online.

p_mobile_dnd 

Mobile: DND.

p_mobile_idle 

Mobile: Idle.

p_status_online 

General: Online.

p_status_dnd 

General: DND.

p_status_idle 

General: Idle.

◆ presence_status

enum dpp::presence_status : uint8_t

Online presence status values.

Enumerator
ps_offline 

Offline.

ps_online 

Online.

ps_dnd 

DND.

ps_idle 

Idle.

◆ region

enum dpp::region : uint8_t

Represents voice regions for guilds and channels.

Note
Largely deprecated in favour of per-channel regions.
Enumerator
r_brazil 

Brazil.

r_central_europe 

Central Europe.

r_hong_kong 

Hong Kong.

r_india 

India.

r_japan 

Japan.

r_russia 

Russia.

r_singapore 

Singapore.

r_south_africa 

South Africa.

r_sydney 

Sydney.

r_us_central 

US Central.

r_us_east 

US East Coast.

r_us_south 

US South.

r_us_west 

US West Coast.

r_western_europe 

Western Europe.

◆ role_flags

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 an @ping.

r_premium_subscriber 

This is set for the role given to nitro.

◆ role_permissions

enum dpp::role_permissions : uint64_t

Represents the various discord permissions.

Enumerator
p_create_instant_invite 

allows creationboosters of instant invites

p_kick_members 

allows kicking members

p_ban_members 

allows banning members

p_administrator 

allows all permissions and bypasses channel permission overwrites

p_manage_channels 

allows management and editing of channels

p_manage_guild 

allows management and editing of the guild

p_add_reactions 

allows for the addition of reactions to messages

p_view_audit_log 

allows for viewing of audit logs

p_priority_speaker 

allows for using priority speaker in a voice channel

p_stream 

allows the user to go live

p_view_channel 

allows guild members to view a channel, which includes reading messages in text channels

p_send_messages 

allows for sending messages in a channel

p_send_tts_messages 

allows for sending of /tts messages

p_manage_messages 

allows for deletion of other users messages

p_embed_links 

links sent by users with this permission will be auto-embedded

p_attach_files 

allows for uploading images and files

p_read_message_history 

allows for reading of message history

p_mention_everyone 

allows for using the @everyone and the @here tag to notify users in a channel

p_use_external_emojis 

allows the usage of custom emojis from other servers

p_view_guild_insights 

allows for viewing guild insights

p_connect 

allows for joining of a voice channel

p_speak 

allows for speaking in a voice channel

p_mute_members 

allows for muting members in a voice channel

p_deafen_members 

allows for deafening of members in a voice channel

p_move_members 

allows for moving of members between voice channels

p_use_vad 

allows for using voice-activity-detection in a voice channel

p_change_nickname 

allows for modification of own nickname

p_manage_nicknames 

allows for modification of other users nicknames

p_manage_roles 

allows management and editing of roles

p_manage_webhooks 

allows management and editing of webhooks

p_manage_emojis 

allows management and editing of emojis

p_use_slash_commands 

allows members to use slash commands

p_request_to_speak 

allows for requesting to speak in stage channels. (Discord: This permission is under active development and may be changed or removed.)

p_manage_threads 

allows for deleting and archiving threads, and viewing all private threads

p_use_public_threads 

allows for creating and participating in thread

p_use_private_threads 

allows for creating and participating in private thread

◆ slashcommand_contextmenu_type

Enumerator
ctxm_none 
ctxm_chat_input 

DEFAULT, these are the slash commands you're used to.

ctxm_user 

Add command to user context menu.

ctxm_message 

Add command to message context menu.

◆ sticker_format

enum dpp::sticker_format : uint8_t

The file format (png, apng, lottie) of a sticker.

Enumerator
sf_png 
sf_apng 
sf_lottie 

◆ sticker_type

enum dpp::sticker_type : uint8_t
Enumerator
st_standard 

Nitro pack sticker.

st_guild 

Guild sticker.

◆ user_flags

Various bitmask flags used to represent information about a dpp::user.

Enumerator
u_bot 

User is a bot.

u_system 

User is a system user (Clyde!)

u_mfa_enabled 

User has multi-factor authentication enabled.

u_verified 

User is verified (verified email address)

u_nitro_full 

User has full nitro.

u_nitro_classic 

User has nitro classic.

u_discord_employee 

User is discord staff.

u_partnered_owner 

User owns a partnered server.

u_hypesquad_events 

User is a member of hypesquad events.

u_bughunter_1 

User has BugHunter level 1.

u_house_bravery 

User is a member of House Bravery.

u_house_brilliance 

User is a member of House Brilliance.

u_house_balanace 

User is a member of House Balance.

u_early_supporter 

User is an early supporter.

u_team_user 

User is a team user.

u_bughunter_2 

User is has Bug Hunter level 2.

u_verified_bot 

User is a verified bot.

u_verified_bot_dev 

User has the Early Verified Bot Developer badge.

u_animated_icon 

User's icon is animated.

u_certified_moderator 

User is a certified moderator.

◆ voiceregion_flags

Flags related to a voice region.

Enumerator
v_optimal 
v_deprecated 
v_custom 
v_vip 

◆ voicestate_flags

Bit mask flags relating to voice states.

Enumerator
vs_deaf 

Deafened.

vs_mute 

Muted.

vs_self_mute 

Self Muted.

vs_self_deaf 

Self Deafened.

vs_self_stream 

Self Streaming.

vs_self_video 

Self Video.

vs_supress 

Supression.

◆ webhook_type

Defines types of webhook.

Enumerator
w_incoming 

Incoming webhook.

w_channel_follower 

Channel following webhook.

◆ ws_opcode

Low-level websocket opcodes for frames.

Enumerator
OP_CONTINUATION 

Continuation.

OP_TEXT 

Text frame.

OP_BINARY 

Binary frame.

OP_CLOSE 

Close notification with close code.

OP_PING 

Low level ping.

OP_PONG 

Low level pong.

◆ ws_state

Websocket connection status.

Enumerator
HTTP_HEADERS 

Sending/receiving HTTP headers prior to protocol switch

CONNECTED 

Connected, upgraded and sending/receiving frames

Function Documentation

◆ base64_encode()

std::string dpp::base64_encode ( unsigned char const *  buf,
unsigned int  buffer_length 
)

Base64 encode data into a string.

Parameters
bufRaw binary buffer
buffer_lengthBuffer length to encode
Returns
The base64 encoded string

◆ BoolNotNull()

bool dpp::BoolNotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns a boolean value from a json field value, if defined, else returns false.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ find_channel()

channel * dpp::find_channel ( snowflake  id)

◆ find_emoji()

emoji * dpp::find_emoji ( snowflake  id)

◆ find_guild()

guild * dpp::find_guild ( snowflake  id)

◆ find_role()

role * dpp::find_role ( snowflake  id)

◆ find_user()

user * dpp::find_user ( snowflake  id)

◆ from_json() [1/6]

void dpp::from_json ( const nlohmann::json j,
command_data_option cdo 
)

helper function to deserialize a command_data_option from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
cdocommand_data_option to be deserialized

◆ from_json() [2/6]

void dpp::from_json ( const nlohmann::json j,
command_interaction ci 
)

helper function to deserialize a command_interaction from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
cicommand_interaction to be deserialized

◆ from_json() [3/6]

void dpp::from_json ( const nlohmann::json j,
component_interaction bi 
)

helper function to deserialize a component_interaction from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
bibutton_interaction to be deserialized

◆ from_json() [4/6]

void dpp::from_json ( const nlohmann::json j,
guild_member gm 
)

helper function to deserialize a guild_member from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
gmguild_member to be deserialized

◆ from_json() [5/6]

void dpp::from_json ( const nlohmann::json j,
interaction i 
)

helper function to deserialize an interaction from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
iinteraction to be deserialized

◆ from_json() [6/6]

void dpp::from_json ( const nlohmann::json j,
user u 
)

helper function to deserialize a user from json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
uuser to be deserialized

◆ garbage_collection()

void dpp::garbage_collection ( )

Run garbage collection across all caches removing deleted items that have been deleted over 60 seconds ago.

◆ get_channel_cache()

cache * dpp::get_channel_cache ( )

◆ get_channel_count()

uint64_t dpp::get_channel_count ( )

◆ get_emoji_cache()

cache * dpp::get_emoji_cache ( )

◆ get_emoji_count()

uint64_t dpp::get_emoji_count ( )

◆ get_guild_cache()

cache * dpp::get_guild_cache ( )

◆ get_guild_count()

uint64_t dpp::get_guild_count ( )

◆ get_role_cache()

cache * dpp::get_role_cache ( )

◆ get_role_count()

uint64_t dpp::get_role_count ( )

◆ get_user_cache()

cache * dpp::get_user_cache ( )

◆ get_user_count()

uint64_t dpp::get_user_count ( )

◆ Int16NotNull()

uint16_t dpp::Int16NotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns a 16 bit unsigned integer from a json field value, if defined, else returns 0.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ Int32NotNull()

uint32_t dpp::Int32NotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns a 32 bit unsigned integer from a json field value, if defined, else returns 0.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ Int64NotNull()

uint64_t dpp::Int64NotNull ( 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!

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ Int8NotNull()

uint8_t dpp::Int8NotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns an 8 bit unsigned integer from a json field value, if defined, else returns 0.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ SetBoolNotNull()

void dpp::SetBoolNotNull ( const nlohmann::json j,
const char *  keyname,
bool &  v 
)

Sets a boolean from a json field value, if defined, else does nothing.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetInt16NotNull()

void dpp::SetInt16NotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetInt32NotNull()

void dpp::SetInt32NotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetInt64NotNull()

void dpp::SetInt64NotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetInt8NotNull()

void dpp::SetInt8NotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetSnowflakeNotNull()

void dpp::SetSnowflakeNotNull ( const nlohmann::json j,
const char *  keyname,
uint64_t &  v 
)

Sets a snowflake id from a json field value, if defined, else does nothing.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetStringNotNull()

void dpp::SetStringNotNull ( const nlohmann::json j,
const char *  keyname,
std::string &  v 
)

Sets a string from a json field value, if defined, else does nothing.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SetTimestampNotNull()

void dpp::SetTimestampNotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
vValue to change

◆ SnowflakeNotNull()

uint64_t dpp::SnowflakeNotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns a snowflake id from a json field value, if defined, else returns 0.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ StringNotNull()

std::string dpp::StringNotNull ( const nlohmann::json j,
const char *  keyname 
)

Returns a string from a json field value, if defined, else returns an empty string.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ TimestampNotNull()

time_t dpp::TimestampNotNull ( 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.

Parameters
jnlohmann::json instance to retrieve value from
keynamekey name to check for a value
Returns
found value

◆ to_json() [1/5]

void dpp::to_json ( nlohmann::json j,
const command_option opt 
)

helper function to serialize a command_option to json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
optcommand_option to be serialized

◆ to_json() [2/5]

void dpp::to_json ( nlohmann::json j,
const command_option_choice choice 
)

helper function to serialize a command_option_choice to json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
choicecommand_option_choice to be serialized

◆ to_json() [3/5]

void dpp::to_json ( nlohmann::json j,
const command_permission cp 
)

helper function to serialize a command_permission to json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
cpcommand_permission to be serialized

◆ to_json() [4/5]

void dpp::to_json ( nlohmann::json j,
const guild_command_permissions gcp 
)

helper function to serialize a guild_command_permissions to json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
gcpguild_command_permissions to be serialized

◆ to_json() [5/5]

void dpp::to_json ( nlohmann::json j,
const slashcommand cmd 
)

helper function to serialize a slashcommand to json

See also
https://github.com/nlohmann/json#arbitrary-types-conversions
Parameters
joutput json object
cmdslashcommand to be serialized

◆ url_encode()

std::string dpp::url_encode ( const std::string &  value)

Encodes a url parameter similar to php urlencode()

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0