| 2 | #include <dpp/unicode_emoji.h> |
| 3 | |
| 4 | int main() { |
| 5 | dpp::cluster bot("Epic Token"); |
| 6 | |
| 7 | bot.on_log(dpp::utility::cout_logger()); |
| 8 | |
| 9 | /* We now have a new character! That's for the select menu. */ |
| 10 | dpp::emoji walter("walter_black", 1179374919088361544); |
| 11 | dpp::emoji mad("mad", 1117795317052616704, dpp::e_animated); /* We need this third argument, which is an emoji flag. */ |
| 12 | |
| 13 | /* The event is fired when someone issues your commands */ |
| 14 | bot.on_slashcommand([walter, mad](const dpp::slashcommand_t& event) { |
| 15 | if (event.command.get_command_name() == "select") { |
| 16 | dpp::message msg(event.command.channel_id, "Now."); |
| 17 | msg.add_component( |
| 18 | dpp::component().add_component( |
| 19 | dpp::component() |
| 20 | .set_type(dpp::cot_selectmenu) |
| 21 | .set_placeholder("Say my name.") |
| 22 | .add_select_option(dpp::select_option("Do what?", "Yeah, you do.", "I don't have a damn clue what you're talking about.").set_emoji(dpp::unicode_emoji::thinking)) |
| 23 | .add_select_option(dpp::select_option("Heisenberg", "You're goddamn right!", "The one and only").set_emoji(walter.name, walter.id)) |
| 24 | .add_select_option(dpp::select_option("I'm unsubscribing", "Wait what", "Pure cruelty").set_emoji(mad.name, mad.id, mad.is_animated())) /* Since our mad emoji is animated, we should tell that to the function */ |
| 25 | .set_id("myselectid") |
| 26 | ) |
| 27 | ); |
| 28 | event.reply(msg); |
| 29 | } |
| 30 | }); |
| 31 | |
| 32 | bot.on_select_click([](const dpp::select_click_t& event) { |
| 33 | event.reply(event.values[0]); |
| 34 | }); |
| 35 | |
| 36 | bot.on_ready([&bot](const dpp::ready_t& event) { |
| 37 | if (dpp::run_once<struct register_bot_commands>()) { |
| 38 | bot.global_command_create(dpp::slashcommand("select", "Send the select menu", bot.me.id)); |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | /* Start the bot! */ |
| 43 | bot.start(dpp::st_wait); |
| 44 | return 0; |
| 45 | } |
nothing calls this directly
no test coverage detected