This example demonstrates adding multiple buttons, receiving button clicks, and sending response messages.
#include <dpp/dpp.h>
int main() {
msg.add_component(
.set_label("9")
.set_id("9")
)
.add_component(
.set_label("10")
.set_id("10")
)
.add_component(
.set_label("11")
.set_id("11")
)
);
event.reply(msg);
}
});
} else {
}
});
bot.global_command_create(
dpp::slashcommand(
"math",
"A quick maths question!", 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
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
@ m_ephemeral
This message is only visible to the user who invoked the Interaction.
Definition message.h:1970
@ cos_primary
Blurple; Primary.
Definition message.h:228
@ st_wait
Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will ...
Definition cluster.h:72
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
User has issued a slash command.
Definition dispatcher.h:806
This code will send a different message for correct and incorrect answers.