Added components, and moved command names to common.hpp
This commit is contained in:
6
src/Commands/Components/GenerativeComponents.cpp
Normal file
6
src/Commands/Components/GenerativeComponents.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "../../Common.hpp"
|
||||
#include "../../Utility/CairoTools.hpp"
|
||||
#include <dpp/cluster.h>
|
||||
#include <dpp/dispatcher.h>
|
||||
|
||||
void componentCancel(COMPONENT_ARGS) { event.edit_response(REQUEST_CANCELLED); }
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user