Added components, and moved command names to common.hpp

This commit is contained in:
2025-07-23 17:56:54 +03:00
parent 4e33e07188
commit ba2ad34d6e
7 changed files with 70 additions and 21 deletions

View File

@@ -17,22 +17,30 @@ void commandGenerateReport(const dpp::slashcommand_t &event,
auto fileType = supportedImageFileTypes.find(file.content_type);
if (fileType != supportedImageFileTypes.end()) {
// Don't forget that its only funny if it is all in upper case
std::string headline =
std::get<std::string>(event.get_parameter("headline"));
// Never seen this method before but looks awesome
std::transform(headline.begin(), headline.end(), headline.data(),
::toupper);
dpp::message confirmRequest(
event.command.channel_id,
COMMAND_GENERATE_REPORT_CONFIRMATION_QUESTION(
std::to_string(COMMAND_GENERATE_REPORT_COST)));
std::to_string(COMMAND_GENERATE_REPORT_COST), file.url, headline));
confirmRequest.add_component(
dpp::component()
.add_component(dpp::component()
.set_label(BUTTON_ACCEPT)
.set_type(dpp::cot_button)
.set_style(dpp::component_style::cos_success)
.set_id("generate_report_confirm"))
.set_id(COMPONENT_GENERATE_REPORT_CONFIRM))
.add_component(dpp::component()
.set_label(BUTTON_CANCEL)
.set_type(dpp::cot_button)
.set_style(dpp::component_style::cos_danger)
.set_id("generate_report_deny")));
.set_id(COMPONENT_COMMAND_CANCEL)));
event.edit_response(confirmRequest);
} else {
event.edit_response(