mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-12-01 08:07:08 +01:00
Update WIP discord and some vendors.
CPR has features disabled and PCRE is fully disabled until updated to new code.
This commit is contained in:
1 parent
e0761bf3b9
commit
9298065cef
1562 files changed
+55070
-76299
No files matched your search
Vendored
+32
-3
@@ -132,7 +132,7 @@ template<class T> inline void rest_request_list(dpp::cluster* c, const char* bas
|
||||
*/
|
||||
template<> inline 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) {
|
||||
c->post_rest(basepath, major, minor, method, postdata, [c, callback](json &j, const http_request_completion_t& http) {
|
||||
std::unordered_map<std::string, invite> list;
|
||||
invite_map list;
|
||||
confirmation_callback_t e(c, confirmation(), http);
|
||||
if (!e.is_error()) {
|
||||
for (auto & curr_item : j) {
|
||||
@@ -160,7 +160,7 @@ template<> inline void rest_request_list<invite>(dpp::cluster* c, const char* ba
|
||||
*/
|
||||
template<> inline 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) {
|
||||
c->post_rest(basepath, major, minor, method, postdata, [c, callback](json &j, const http_request_completion_t& http) {
|
||||
std::unordered_map<std::string, voiceregion> list;
|
||||
voiceregion_map list;
|
||||
confirmation_callback_t e(c, confirmation(), http);
|
||||
if (!e.is_error()) {
|
||||
for (auto & curr_item : j) {
|
||||
@@ -172,9 +172,38 @@ template<> inline void rest_request_list<voiceregion>(dpp::cluster* c, const cha
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @brief Templated REST request helper to save on typing (for returned lists, specialised for bans)
|
||||
*
|
||||
* @tparam T singular type to return in lambda callback
|
||||
* @tparam T map type to return in lambda callback
|
||||
* @param c calling cluster
|
||||
* @param basepath base path for API call
|
||||
* @param major major API function
|
||||
* @param minor minor API function
|
||||
* @param method HTTP method
|
||||
* @param postdata Post data or empty string
|
||||
* @param key Key name of elements in the json list
|
||||
* @param callback Callback lambda
|
||||
*/
|
||||
template<> inline void rest_request_list<ban>(dpp::cluster* c, const char* basepath, const std::string &major, const std::string &minor, http_method method, const std::string& postdata, command_completion_event_t callback, const std::string& key) {
|
||||
c->post_rest(basepath, major, minor, method, postdata, [c, callback](json &j, const http_request_completion_t& http) {
|
||||
std::unordered_map<snowflake, ban> list;
|
||||
confirmation_callback_t e(c, confirmation(), http);
|
||||
if (!e.is_error()) {
|
||||
for (auto & curr_item : j) {
|
||||
ban curr_ban = ban().fill_from_json(&curr_item);
|
||||
list[curr_ban.user_id] = curr_ban;
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(confirmation_callback_t(c, list, http));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Templated REST request helper to save on typing (for returned vectors)
|
||||
* @brief Templated REST request helper to save on typing (for returned lists, specialised for objects which doesn't have ids)
|
||||
*
|
||||
* @tparam T singular type to return in lambda callback
|
||||
* @tparam T vector type to return in lambda callback
|
||||
|
||||
Reference in new issue
Block a user