mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-12-18 05:03:28 +00:00
스킵 구현
This commit is contained in:
28
DPP-master/docpages/example_code/ephemeral.cpp
Normal file
28
DPP-master/docpages/example_code/ephemeral.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
int main() {
|
||||
/* Create the bot */
|
||||
dpp::cluster bot("token");
|
||||
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
/* The event is fired when someone issues your commands */
|
||||
bot.on_slashcommand([&bot](const dpp::slashcommand_t & event) {
|
||||
/* Check which command they ran */
|
||||
if (event.command.get_command_name() == "hello") {
|
||||
/* Reply to the user, but only let them see the response. */
|
||||
event.reply(dpp::message("Hello! How are you today?").set_flags(dpp::m_ephemeral));
|
||||
}
|
||||
});
|
||||
|
||||
bot.on_ready([&bot](const dpp::ready_t & event) {
|
||||
if (dpp::run_once<struct register_bot_commands>()) {
|
||||
/* Create and Register the command */
|
||||
bot.global_command_create(dpp::slashcommand("hello", "Hello there!", bot.me.id));
|
||||
}
|
||||
});
|
||||
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user