This first example demonstrates creating a select menu, receiving select menu clicks, and sending a response message.
#include <dpp/dpp.h>
#include <dpp/unicode_emoji.h>
int main() {
msg.add_component(
.set_placeholder("Pick something")
.set_id("myselectid")
)
);
event.reply(msg);
}
});
event.reply(
"You clicked " + event.
custom_id +
" and chose: " + event.
values[0]);
});
bot.global_command_create(
dpp::slashcommand(
"select",
"Select something at random!", bot.me.id));
}
});
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition cluster.h:89
Represents the component object. A component is a clickable button or drop down list within a discord...
Definition message.h:497
snowflake channel_id
Optional: the channel it was sent from.
Definition appcommand.h:1043
std::string get_command_name() const
Get the command name for a command interaction.
Represents an application command, created by your bot either globally, or on a guild.
Definition appcommand.h:1436
constexpr const char smile[]
Definition unicode_emoji.h:1604
constexpr const char slight_smile[]
Definition unicode_emoji.h:1618
std::function< void(const dpp::log_t &)> DPP_EXPORT cout_logger()
Get a default logger that outputs to std::cout. e.g.
auto run_once()
Run some code within an if() statement only once.
Definition once.h:41
@ st_wait
Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will ...
Definition cluster.h:72
@ cot_selectmenu
Select menu for picking from defined text options.
Definition message.h:53
interaction command
command interaction
Definition dispatcher.h:789
Represents messages sent and received on Discord.
Definition message.h:2350
Session ready.
Definition dispatcher.h:1072
Click on select.
Definition dispatcher.h:953
std::vector< std::string > values
select menu values
Definition dispatcher.h:968
std::string custom_id
select menu custom id
Definition dispatcher.h:963
An option for a select component.
Definition message.h:287
User has issued a slash command.
Definition dispatcher.h:806