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

Method guild_command_create

src/dpp/cluster/appcommand.cpp:91–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {
93 if (callback) {
94 callback(confirmation_callback_t(this, slashcommand().fill_from_json(&j), http));
95 }
96
97 if (http.status < 300 && s.permissions.size()) {
98 slashcommand n;
99 n.fill_from_json(&j);
100 n.permissions = s.permissions;
101 guild_command_edit_permissions(n, guild_id);
102 }
103 });
104}
105
106void cluster::guild_command_delete(snowflake id, snowflake guild_id, command_completion_event_t callback) {
107 rest_request<confirmation>(this, API_PATH "/applications", std::to_string(me.id), "guilds/" + std::to_string(guild_id) + "/commands/" + std::to_string(id), m_delete, "", callback);

Callers 3

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 6

post_restMethod · 0.95
to_stringFunction · 0.85
callbackClass · 0.85
build_jsonMethod · 0.80
sizeMethod · 0.45

Tested by 1

mainFunction · 0.64