| 72 | } |
| 73 | |
| 74 | void 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 | |
| 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 { |