This example demonstrates receiving button clicks and sending response messages.
#include <dpp/dpp.h>
int main()
{
event.reply(dpp::ir_channel_message_with_source, dpp::message("Correct").set_flags(dpp::m_ephemeral));
} else {
event.reply(dpp::ir_channel_message_with_source, 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:216
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62
Create message.
Definition: dispatcher.h:655
message * msg
Definition: dispatcher.h:661
std::string content
Definition: message.h:743
This code will send a different message for correct and incorrect answers.