Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dpp/dpp.h>
- #include <iostream>
- int main(int argc, char* argv[])
- {
- dpp::cluster bot("token", dpp::intents::i_default_intents | dpp::intents::i_message_content | dpp::intents::i_guild_members);
- bot.on_log(dpp::utility::cout_logger());
- bot.on_ready([&bot](const dpp::ready_t& event) {
- if (dpp::run_once<struct register_bot_commands>()) {
- bot.global_command_create(
- dpp::slashcommand().
- set_type(dpp::ctxm_user).
- set_name("High Five").
- set_application_id(bot.me.id)
- );
- bot.global_command_create(
- dpp::slashcommand("about", "Information about the bot.", bot.me.id)
- );
- bot.global_command_create(
- dpp::slashcommand("animalz", "Given options for animalz", bot.me.id).add_option(
- dpp::command_option(dpp::co_string,"animal","type of Animal")
- .add_choice(dpp::command_option_choice("Oklahoma dawg",std::string("Oklahoma dawg")))
- .add_choice(dpp::command_option_choice("Ohio kitten",std::string("Ohio kitten")))
- )
- );
- }
- });
- bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
- dpp::user IssuingUser = event.command.get_issuing_user();
- if (event.command.get_command_name() == "about") {
- event.reply(
- dpp::message(event.command.channel_id, "").add_embed(
- dpp::embed()
- .set_author(IssuingUser.username,"https://dpp.dev",IssuingUser.get_avatar_url())
- .set_color(dpp::colors::moon_yellow)
- .set_title("About the bot")
- .set_description("Yea totally useless bio about the bot LOL!")
- .set_thumbnail("https://i.ibb.co/8YPvPcS/Thinking-Face-Emoji-Emoji-Island.webp")
- .add_field(
- "About:",
- "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."
- )
- )
- );
- }
- else if (event.command.get_command_name() == "animalz") {
- std::string Param = std::get<std::string>(event.get_parameter("animal"));
- event.reply("Wow `"+Param+"`! Nice choice!!!!!!!");
- }
- });
- bot.on_user_context_menu([&bot](const dpp::user_context_menu_t& event) {
- dpp::user User = event.command.get_issuing_user();
- if (event.command.get_command_name() == "High Five") {
- dpp::user Coller = event.get_user();
- event.reply(User.get_mention() + " high fived " + Coller.get_mention());
- }
- });
- bot.start(dpp::st_wait);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement