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

Method guild_bulk_command_create

src/dpp/cluster/appcommand.cpp:58–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void cluster::guild_bulk_command_create(const std::vector<slashcommand> &commands, snowflake guild_id, command_completion_event_t callback) {
59 json j = json::array();
60 for (auto & s : commands) {
61 j.push_back(s.to_json(false));
62 }
63 rest_request_list<slashcommand>(this, API_PATH "/applications", std::to_string(commands.size() > 0 && commands[0].application_id ? commands[0].application_id : me.id), "guilds/" + std::to_string(guild_id) + "/commands", m_put, j.dump(-1, ' ', false, json::error_handler_t::replace), callback);
64}
65
66void cluster::guild_bulk_command_delete(snowflake guild_id, command_completion_event_t callback) {
67 rest_request_list<slashcommand>(this, API_PATH "/applications", std::to_string(me.id), "guilds/" + std::to_string(guild_id) + "/commands", m_put, "{}", callback);

Callers 2

mainFunction · 0.80
commandhandler.cppFile · 0.80

Calls 5

to_stringFunction · 0.85
push_backMethod · 0.80
to_jsonMethod · 0.45
sizeMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected