mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-22 18:17:11 +02:00
Update DPP.
This commit is contained in:
2
vendor/DPP/include/dpp/cache.h
vendored
2
vendor/DPP/include/dpp/cache.h
vendored
@ -88,7 +88,7 @@ namespace dpp {
|
||||
* @brief Get the container map
|
||||
* @warning Be sure to use cache::get_mutex() correctly if you
|
||||
* manipulate or iterate the map returned by this method! If you do
|
||||
* not, this is not thread safe and will casue crashes!
|
||||
* not, this is not thread safe and will cause crashes!
|
||||
* @see cache::get_mutex
|
||||
*
|
||||
* @return cache_container& A reference to the cache's container map
|
||||
|
6
vendor/DPP/include/dpp/cluster.h
vendored
6
vendor/DPP/include/dpp/cluster.h
vendored
@ -290,8 +290,8 @@ public:
|
||||
* @param shards The total number of shards on this bot. If there are multiple clusters, then (shards / clusters) actual shards will run on this cluster.
|
||||
* If you omit this value, the library will attempt to query the Discord API for the correct number of shards to start.
|
||||
* @param cluster_id The ID of this cluster, should be between 0 and MAXCLUSTERS-1
|
||||
* @param maxclusters The total number of clusters that are active, which may be on seperate processes or even separate machines.
|
||||
* @param compressed Wether or not to use compression for shards on this cluster. Saves a ton of bandwidth at the cost of some CPU
|
||||
* @param maxclusters The total number of clusters that are active, which may be on separate processes or even separate machines.
|
||||
* @param compressed Whether or not to use compression for shards on this cluster. Saves a ton of bandwidth at the cost of some CPU
|
||||
* @param policy Set the user caching policy for the cluster, either lazy (only cache users/members when they message the bot) or aggressive (request whole member lists on seeing new guilds too)
|
||||
*/
|
||||
cluster(const std::string &token, uint32_t intents = i_default_intents, uint32_t shards = 0, uint32_t cluster_id = 0, uint32_t maxclusters = 1, bool compressed = true, cache_policy_t policy = {cp_aggressive, cp_aggressive, cp_aggressive});
|
||||
@ -1968,7 +1968,7 @@ public:
|
||||
void thread_create(const std::string& thread_name, snowflake channel_id, uint16_t auto_archive_duration, channel_type thread_type, command_completion_event_t callback = {});
|
||||
|
||||
/**
|
||||
* @brief Create a thread with a message (Discord: ID of a thread is same as mesage ID)
|
||||
* @brief Create a thread with a message (Discord: ID of a thread is same as message ID)
|
||||
*
|
||||
* @param thread_name Name of the thread
|
||||
* @param channel_id Channel in which thread to create
|
||||
|
40
vendor/DPP/include/dpp/commandhandler.h
vendored
40
vendor/DPP/include/dpp/commandhandler.h
vendored
@ -30,11 +30,29 @@
|
||||
|
||||
namespace dpp {
|
||||
|
||||
/**
|
||||
* @brief 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.
|
||||
*/
|
||||
struct CoreExport resolved_user {
|
||||
/**
|
||||
* @brief Holds user information
|
||||
*/
|
||||
dpp::user user;
|
||||
/**
|
||||
* @brief Holds member information
|
||||
*/
|
||||
dpp::guild_member member;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Represents a received parameter.
|
||||
* We use variant so that multiple non-related types can be contained within.
|
||||
*/
|
||||
typedef std::variant<std::string, dpp::role, dpp::channel, dpp::user, int32_t, bool> command_parameter;
|
||||
typedef std::variant<std::monostate, std::string, dpp::role, dpp::channel, dpp::resolved_user, int32_t, bool> command_parameter;
|
||||
|
||||
/**
|
||||
* @brief Parameter types when registering a command.
|
||||
@ -102,7 +120,7 @@ typedef std::vector<std::pair<std::string, param_info>> parameter_registration_t
|
||||
|
||||
/**
|
||||
* @brief Parameter list for a called command.
|
||||
* See dpp::parameter_registration_t for an explaination as to why vector is used.
|
||||
* See dpp::parameter_registration_t for an explanation as to why vector is used.
|
||||
*/
|
||||
typedef std::vector<std::pair<std::string, command_parameter>> parameter_list_t;
|
||||
|
||||
@ -277,9 +295,25 @@ public:
|
||||
* to the user if you do not emit some form of reply within 3 seconds.
|
||||
*
|
||||
* @param m message to reply with.
|
||||
* @param interaction true if the reply is generated by an interaction
|
||||
* @param source source of the command
|
||||
*/
|
||||
void reply(const dpp::message &m, command_source source);
|
||||
|
||||
/**
|
||||
* @brief Reply to a command without a message, causing the discord client
|
||||
* to display "Bot name is thinking...".
|
||||
* The "thinking" message will persist for a maximum of 15 minutes.
|
||||
* This counts as a reply for a slash command. Slash commands will emit an
|
||||
* ugly error to the user if you do not emit some form of reply within 3
|
||||
* seconds.
|
||||
*
|
||||
* @param source source of the command
|
||||
*/
|
||||
void thinking(command_source source);
|
||||
|
||||
/* Easter egg */
|
||||
void thonk(command_source source);
|
||||
|
||||
};
|
||||
|
||||
};
|
4
vendor/DPP/include/dpp/discord.h
vendored
4
vendor/DPP/include/dpp/discord.h
vendored
@ -186,7 +186,7 @@ namespace dpp {
|
||||
* @brief Convert a byte count to display value
|
||||
*
|
||||
* @param c number of bytes
|
||||
* @return std::string display value suffixed with M, G, T where neccessary
|
||||
* @return std::string display value suffixed with M, G, T where necessary
|
||||
*/
|
||||
std::string CoreExport bytes(uint64_t c);
|
||||
|
||||
@ -257,7 +257,7 @@ namespace dpp {
|
||||
* @param str string to return substring from
|
||||
* @param start start codepoint offset
|
||||
* @param length length in codepoints
|
||||
* @return std::string Substring in UTF-8 or emtpy string if invalid UTF-8 passed in
|
||||
* @return std::string Substring in UTF-8 or empty string if invalid UTF-8 passed in
|
||||
*/
|
||||
std::string CoreExport utf8substr(const std::string& str, std::string::size_type start, std::string::size_type length);
|
||||
};
|
||||
|
2
vendor/DPP/include/dpp/discordvoiceclient.h
vendored
2
vendor/DPP/include/dpp/discordvoiceclient.h
vendored
@ -201,7 +201,7 @@ class CoreExport discord_voice_client : public websocket_client
|
||||
int UDPSend(const char* data, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Receieve data from UDP socket immediately.
|
||||
* @brief Receive data from UDP socket immediately.
|
||||
*
|
||||
* @param data data to receive
|
||||
* @param max_length size of data receiving buffer
|
||||
|
2
vendor/DPP/include/dpp/dispatcher.h
vendored
2
vendor/DPP/include/dpp/dispatcher.h
vendored
@ -1095,7 +1095,7 @@ public:
|
||||
* @param event Event parameters
|
||||
*/
|
||||
std::function<void(const voice_ready_t& event)> voice_ready;
|
||||
/** @brief Event handler function pointer for voice receieve event
|
||||
/** @brief Event handler function pointer for voice receive event
|
||||
* @param event Event parameters
|
||||
*/
|
||||
std::function<void(const voice_receive_t& event)> voice_receive;
|
||||
|
2
vendor/DPP/include/dpp/guild.h
vendored
2
vendor/DPP/include/dpp/guild.h
vendored
@ -207,7 +207,7 @@ public:
|
||||
/** Setting for how notifications are to be delivered to users */
|
||||
uint8_t default_message_notifications;
|
||||
|
||||
/** Wether or not explicit content filtering is enable and what setting it is */
|
||||
/** Whether or not explicit content filtering is enable and what setting it is */
|
||||
uint8_t explicit_content_filter;
|
||||
|
||||
/** If multi factor authentication is required for moderators or not */
|
||||
|
18
vendor/DPP/include/dpp/message.h
vendored
18
vendor/DPP/include/dpp/message.h
vendored
@ -474,7 +474,7 @@ struct CoreExport embed {
|
||||
/** Add an embed field. Returns the embed itself so these method calls may be "chained"
|
||||
* @param name The name of the field
|
||||
* @param value The value of the field (max length 1000)
|
||||
* @param is_inline Wether or not to display the field 'inline' or on its own line
|
||||
* @param is_inline Whether or not to display the field 'inline' or on its own line
|
||||
* @return A reference to self
|
||||
*/
|
||||
embed& add_field(const std::string& name, const std::string &value, bool is_inline = false);
|
||||
@ -569,6 +569,8 @@ struct CoreExport attachment {
|
||||
uint32_t height;
|
||||
/** MIME type of the attachment, if applicable */
|
||||
std::string content_type;
|
||||
/** Whether this attachment is ephemeral, if applicable */
|
||||
bool ephemeral;
|
||||
|
||||
/**
|
||||
* @brief Constructs a new attachment object.
|
||||
@ -724,7 +726,7 @@ enum message_flags {
|
||||
/// this message originated from a message in another channel (via Channel Following)
|
||||
m_is_crosspost = 1 << 1,
|
||||
/// do not include any embeds when serializing this message
|
||||
m_supress_embeds = 1 << 2,
|
||||
m_suppress_embeds = 1 << 2,
|
||||
/// the source message for this crosspost has been deleted (via Channel Following)
|
||||
m_source_message_deleted = 1 << 3,
|
||||
/// this message came from the urgent message system
|
||||
@ -736,7 +738,7 @@ enum message_flags {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Mesage types for dpp::message::type
|
||||
* @brief Message types for dpp::message::type
|
||||
*/
|
||||
enum message_type {
|
||||
/// Default
|
||||
@ -970,9 +972,9 @@ struct CoreExport message {
|
||||
/**
|
||||
* @brief Set the allowed mentions object for pings on the message
|
||||
*
|
||||
* @param _parse_users wether or not to parse users in the message content or embeds
|
||||
* @param _parse_roles wether or not to parse roles in the message content or embeds
|
||||
* @param _parse_everyone wether or not to parse everyone/here in the message content or embeds
|
||||
* @param _parse_users whether or not to parse users in the message content or embeds
|
||||
* @param _parse_roles whether or not to parse roles in the message content or embeds
|
||||
* @param _parse_everyone whether or not to parse everyone/here in the message content or embeds
|
||||
* @param _replied_user if set to true and this is a reply, then ping the user we reply to
|
||||
* @param users list of user ids to allow pings for
|
||||
* @param roles list of role ids to allow pings for
|
||||
@ -982,7 +984,7 @@ struct CoreExport message {
|
||||
|
||||
/** Fill this object from json.
|
||||
* @param j JSON object to fill from
|
||||
* @param cp Cache policy for user records, wether or not we cache users when a message is received
|
||||
* @param cp Cache policy for user records, whether or not we cache users when a message is received
|
||||
* @return A reference to self
|
||||
*/
|
||||
message& fill_from_json(nlohmann::json* j, cache_policy_t cp = {cp_aggressive, cp_aggressive, cp_aggressive});
|
||||
@ -1012,7 +1014,7 @@ struct CoreExport message {
|
||||
*
|
||||
* @return true if embeds removed
|
||||
*/
|
||||
bool supress_embeds() const;
|
||||
bool suppress_embeds() const;
|
||||
|
||||
/**
|
||||
* @brief True if source message was deleted
|
||||
|
30
vendor/DPP/include/dpp/slashcommand.h
vendored
30
vendor/DPP/include/dpp/slashcommand.h
vendored
@ -54,8 +54,10 @@ enum command_option_type : uint8_t {
|
||||
* @brief 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.
|
||||
*/
|
||||
typedef std::variant<std::string, int32_t, bool, snowflake> command_value;
|
||||
typedef std::variant<std::monostate, std::string, int32_t, bool, snowflake> command_value;
|
||||
|
||||
/**
|
||||
* @brief This struct represents choices in a multiple choice option
|
||||
@ -157,8 +159,6 @@ void to_json(nlohmann::json& j, const command_option& opt);
|
||||
*/
|
||||
enum interaction_response_type {
|
||||
ir_pong = 1, //!< ACK a Ping
|
||||
ir_acknowledge = 2, //!< DEPRECATED ACK a command without sending a message, eating the user's input
|
||||
ir_channel_message = 3, //!< DEPRECATED respond with a message, eating the user's input
|
||||
ir_channel_message_with_source = 4, //!< respond to an interaction with a message
|
||||
ir_deferred_channel_message_with_source = 5, //!< ACK an interaction and edit a response later, the user sees a loading state
|
||||
ir_deferred_update_message = 6, //!< for components, ACK an interaction and edit the original message later; the user does not see a loading state
|
||||
@ -226,11 +226,25 @@ struct CoreExport interaction_response {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Resolved snowflake ids to usernames.
|
||||
* TODO: Needs implementation. Not needed something that
|
||||
* functions as we have cache.
|
||||
* @brief Resolved snowflake ids to users, guild members, roles and channels.
|
||||
*/
|
||||
struct CoreExport command_resolved {
|
||||
/**
|
||||
* @brief Resolved users
|
||||
*/
|
||||
std::map<dpp::snowflake, dpp::user> users;
|
||||
/**
|
||||
* @brief Resolved guild members
|
||||
*/
|
||||
std::map<dpp::snowflake, dpp::guild_member> members;
|
||||
/**
|
||||
* @brief Resolved roles
|
||||
*/
|
||||
std::map<dpp::snowflake, dpp::role> roles;
|
||||
/**
|
||||
* @brief Resolved channels
|
||||
*/
|
||||
std::map<dpp::snowflake, dpp::channel> channels;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -272,7 +286,6 @@ enum interaction_type {
|
||||
struct CoreExport command_interaction {
|
||||
snowflake id; //!< the ID of the invoked command
|
||||
std::string name; //!< the name of the invoked command
|
||||
command_resolved resolved; //!< Optional: converted users + roles + channels
|
||||
std::vector<command_data_option> options; //!< Optional: the params + values from the user
|
||||
};
|
||||
|
||||
@ -326,6 +339,7 @@ public:
|
||||
user usr; //!< Optional: user object for the invoking user, if invoked in a DM
|
||||
std::string token; //!< a continuation token for responding to the interaction
|
||||
uint8_t version; //!< read-only property, always 1
|
||||
command_resolved resolved; //!< Resolved user/role etc
|
||||
|
||||
/**
|
||||
* @brief Fill object properties from JSON
|
||||
@ -513,7 +527,7 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Disable default permissions, command will be unusable unless
|
||||
* permissions are overriden with add_permission and
|
||||
* permissions are overridden with add_permission and
|
||||
* dpp::guild_command_edit_permissions
|
||||
*
|
||||
* @return slashcommand& reference to self for chaining of calls
|
||||
|
6
vendor/DPP/include/dpp/version.h
vendored
6
vendor/DPP/include/dpp/version.h
vendored
@ -21,9 +21,9 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(DPP_VERSION_LONG)
|
||||
#define DPP_VERSION_LONG 0x00090003
|
||||
#define DPP_VERSION_SHORT 090003
|
||||
#define DPP_VERSION_TEXT "D++ 9.0.3 (05-Sep-2021)"
|
||||
#define DPP_VERSION_LONG 0x00090004
|
||||
#define DPP_VERSION_SHORT 090004
|
||||
#define DPP_VERSION_TEXT "D++ 9.0.5 (14-Sep-2021)"
|
||||
|
||||
#define DPP_VERSION_MAJOR ((DPP_VERSION_LONG & 0x00ff0000) >> 16)
|
||||
#define DPP_VERSION_MINOR ((DPP_VERSION_LONG & 0x0000ff00) >> 8)
|
||||
|
8
vendor/DPP/include/dpp/voicestate.h
vendored
8
vendor/DPP/include/dpp/voicestate.h
vendored
@ -34,7 +34,7 @@ enum voicestate_flags {
|
||||
vs_self_deaf = 0b00001000, //!< Self Deafened
|
||||
vs_self_stream = 0b00010000, //!< Self Streaming
|
||||
vs_self_video = 0b00100000, //!< Self Video
|
||||
vs_supress = 0b01000000 //!< Supression
|
||||
vs_suppress = 0b01000000 //!< Suppression
|
||||
};
|
||||
|
||||
/**
|
||||
@ -94,9 +94,9 @@ public:
|
||||
/// Return true if the user is in video
|
||||
bool self_video() const;
|
||||
|
||||
/// Return true if user is surpressed.
|
||||
/// "HELP HELP I'M BEING SUPRESSED!"
|
||||
bool is_supressed() const;
|
||||
/// Return true if user is suppressed.
|
||||
/// "HELP HELP I'M BEING SUPPRESSED!"
|
||||
bool is_suppressed() const;
|
||||
};
|
||||
|
||||
/** A container of voicestates */
|
||||
|
Reference in New Issue
Block a user