| 89 | } |
| 90 | |
| 91 | void 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 | |
| 106 | void 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); |