clearing_slashcommands

# Clearing Registered Commands

After a while of creating commands, you may start to wonder "hm, how can I clear these?". Well, this tutorial covers it! All you have to do is simply call dpp::cluster::global_bulk_command_delete or dpp::cluster::guild_bulk_command_delete.

Clearing global commands will only clear commands that were made globally, same goes for the opposite way round. The example will demonstrate using both functions.

    #include<dpp/dpp.h>

    intmain(){
    dpp::clusterbot("token");

    bot.on_log(dpp::utility::cout_logger());

    /*Wewon'tbeperforminganycommands,sowedon'tneedtoaddtheeventhere!*/

    bot.on_ready([&bot](constdpp::ready_t&event){
    if(dpp::run_once<struct clear_bot_commands>()){
    /*Now,we'regoingtowipeourcommands*/
    bot.global_bulk_command_delete();
    /*Thisonerequiresaguildid,otherwiseitwon'tknowwhatguild'scommandsitneedstowipe!*/
    bot.guild_bulk_command_delete(857692897221033129);
    }

    /*Becausetherun_onceaboveusesa'clear_bot_commands'struct,youcancontinuetoregistercommandsbelow!*/
    });

    bot.start(dpp::st_wait);

    return0;
    }