Advertisement
Touch_Grass

Untitled

Mar 13th, 2023
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | Source Code | 0 0
  1. #include <dpp/dpp.h>
  2. #include <iostream>
  3.  
  4. int main(int argc, char* argv[])
  5. {
  6.     dpp::cluster bot("rel");
  7.     bot.on_log(dpp::utility::cout_logger());
  8.  
  9.     bot.on_ready([&bot](const dpp::ready_t& event) {
  10.         if (dpp::run_once<struct register_bot_commands>()) {
  11.             bot.global_command_create(
  12.                 dpp::slashcommand("button","Cool",bot.me.id)
  13.             );
  14.         }
  15.     });
  16.  
  17.     bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
  18.         if (event.command.get_command_name() == "button") {
  19.             event.reply(
  20.                 dpp::message(event.command.channel_id, "Here ya go").add_component(
  21.                     dpp::component()
  22.                     .set_type(dpp::cot_button)
  23.                     .set_style(dpp::cos_primary)
  24.                     .set_label("Button")
  25.                     .set_id("button")
  26.                 )
  27.             );
  28.         }
  29.     });
  30.  
  31.     bot.on_button_click([&bot](const dpp::button_click_t& event) {
  32.         if (event.custom_id == "button") {
  33.             event.reply("MUAHAHAHHAHA YOU FELL INTO MY TRAP LOSER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  34.         }
  35.     });
  36.  
  37.  
  38.  
  39.     bot.start(dpp::st_wait);
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement