This example demonstrates receiving button clicks and sending response messages.
#include <dpp/dpp.h>
using json = nlohmann::json;
int main() {
event.reply(dpp::message("Correct").set_flags(dpp::m_ephemeral));
} else {
event.reply(dpp::message("Incorrect").set_flags(dpp::m_ephemeral));
}
});
bot.message_create(
dpp::message(event.msg.channel_id, "What is 5+5?").add_component(
dpp::component().add_component(
dpp::component().set_label("9").
set_style(dpp::cos_primary).
set_id("9")
).add_component(
dpp::component().set_label("10").
set_style(dpp::cos_primary).
set_id("10")
).add_component(
dpp::component().set_label("11").
set_style(dpp::cos_primary).
set_id("11")
)
)
);
}
});
bot.start(false);
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition: cluster.h:467
std::function< void(const dpp::log_t &)> DPP_EXPORT cout_logger()
Get a default logger that outputs to std::cout. e.g.
@ i_message_content
Intent for receipt of message content.
Definition: intents.h:64
@ i_default_intents
Default D++ intents (all non-privileged intents)
Definition: intents.h:68
Create message.
Definition: dispatcher.h:1289
message msg
message that was created (sent).
Definition: dispatcher.h:1298
std::string content
Definition: message.h:1117
This code will send a different message for correct and incorrect answers.