MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / guild_bulk_command_edit_permissions

Method guild_bulk_command_edit_permissions

src/dpp/cluster/appcommand.cpp:74–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void cluster::guild_bulk_command_edit_permissions(const std::vector<slashcommand> &commands, snowflake guild_id, command_completion_event_t callback) {
75 if (commands.empty()) {
76 return;
77 }
78 json j = json::array();
79 for (auto & s : commands) {
80 json jcommand;
81 jcommand["id"] = s.id;
82 jcommand["permissions"] = json::array();
83 for (auto & c : s.permissions) {
84 jcommand["permissions"].push_back(c);
85 }
86 j.push_back(jcommand);
87 }
88 rest_request_list<guild_command_permissions>(this, API_PATH "/applications", std::to_string(me.id), "guilds/" + std::to_string(guild_id) + "/commands/permissions", m_put, j.dump(-1, ' ', false, json::error_handler_t::replace), callback);
89}
90
91void cluster::guild_command_create(const slashcommand &s, snowflake guild_id, command_completion_event_t callback) {
92 this->post_rest(API_PATH "/applications", std::to_string(s.application_id ? s.application_id : me.id), "guilds/" + std::to_string(guild_id) + "/commands", m_post, s.build_json(false), [s, this, guild_id, callback] (json &j, const http_request_completion_t& http) mutable {

Callers

nothing calls this directly

Calls 4

to_stringFunction · 0.85
push_backMethod · 0.80
emptyMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected