| 1 | #include <dpp/dpp.h> |
| 2 | |
| 3 | int main() { |
| 4 | /* We must use the special constant NO_SHARDS here */ |
| 5 | dpp::cluster bot("TOKEN", 0, dpp::NO_SHARDS); |
| 6 | |
| 7 | bot.on_log(dpp::utility::cout_logger()); |
| 8 | |
| 9 | bot.on_ready([&](const dpp::ready_t& ready) { |
| 10 | /* Enable discord interactions endpoint on port 3000 |
| 11 | * NOTE: PUT YOUR OWN PUBLIC KEY HERE FOR THE FIRST PARAMETER. |
| 12 | * You can find this on the same page where you entered the Discord Interaction URL. |
| 13 | * Do not use your Discord bot token in this field! |
| 14 | */ |
| 15 | bot.enable_webhook_server("f8032a386dc1903787be887cd66d126e83eb3d481455aca509a4b8cbc526cafe", "0.0.0.0", 3000); |
| 16 | /* Register a command */ |
| 17 | bot.global_command_create(dpp::slashcommand("hello", "Greets you", bot.me.id)); |
| 18 | |
| 19 | }); |
| 20 | |
| 21 | bot.on_slashcommand([&](const dpp::slashcommand_t& event) { |
| 22 | event.reply("hello to you too"); |
| 23 | }); |
| 24 | |
| 25 | bot.start(dpp::st_wait); |
| 26 | } |