Advertisement
Touch_Grass

Untitled

Mar 13th, 2023
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.84 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("token", dpp::intents::i_default_intents | dpp::intents::i_message_content | dpp::intents::i_guild_members);
  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().
  13.                 set_type(dpp::ctxm_user).
  14.                 set_name("High Five").
  15.                 set_application_id(bot.me.id)
  16.             );
  17.             bot.global_command_create(
  18.                 dpp::slashcommand("about", "Information about the bot.", bot.me.id)
  19.             );
  20.             bot.global_command_create(
  21.                 dpp::slashcommand("animalz", "Given options for animalz", bot.me.id).add_option(
  22.                     dpp::command_option(dpp::co_string,"animal","type of Animal")
  23.                     .add_choice(dpp::command_option_choice("Oklahoma dawg",std::string("Oklahoma dawg")))
  24.                     .add_choice(dpp::command_option_choice("Ohio kitten",std::string("Ohio kitten")))
  25.                 )
  26.             );
  27.         }
  28.     });
  29.  
  30.     bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
  31.         dpp::user IssuingUser = event.command.get_issuing_user();
  32.         if (event.command.get_command_name() == "about") {
  33.             event.reply(
  34.                 dpp::message(event.command.channel_id, "").add_embed(
  35.                     dpp::embed()
  36.                     .set_author(IssuingUser.username,"https://dpp.dev",IssuingUser.get_avatar_url())
  37.                     .set_color(dpp::colors::moon_yellow)
  38.                     .set_title("About the bot")
  39.                     .set_description("Yea totally useless bio about the bot LOL!")
  40.                     .set_thumbnail("https://i.ibb.co/8YPvPcS/Thinking-Face-Emoji-Emoji-Island.webp")
  41.                     .add_field(
  42.                         "About:",
  43.                         "This bot was developed for testing purposes and to get into Ro devs programmer role. I am just developing this to learn new stuff for fun."
  44.                     )
  45.                 )
  46.             );
  47.         }
  48.         else if (event.command.get_command_name() == "animalz") {
  49.             std::string Param = std::get<std::string>(event.get_parameter("animal"));
  50.             event.reply("Wow `"+Param+"`! Nice choice!!!!!!!");
  51.         }
  52.     });
  53.  
  54.     bot.on_user_context_menu([&bot](const dpp::user_context_menu_t& event) {
  55.         dpp::user User = event.command.get_issuing_user();
  56.         if (event.command.get_command_name() == "High Five") {
  57.             dpp::user Coller = event.get_user();
  58.             event.reply(User.get_mention() + " high fived " + Coller.get_mention());
  59.         }
  60.     });
  61.  
  62.  
  63.  
  64.     bot.start(dpp::st_wait);
  65.  
  66.     return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement