Moved static string to locale
This commit is contained in:
@@ -14,6 +14,12 @@
|
|||||||
"Upload a background image to use (Only supports PNG, JPEG, and WEBP files)"
|
"Upload a background image to use (Only supports PNG, JPEG, and WEBP files)"
|
||||||
#define COMMAND_GENERATE_REPORT_ARGS_HEADLINE_DESCRIPTION \
|
#define COMMAND_GENERATE_REPORT_ARGS_HEADLINE_DESCRIPTION \
|
||||||
"What is the headline?"
|
"What is the headline?"
|
||||||
|
#define COMMAND_GENERATE_REPORT_FAIL_NOT_SUPPORTED(filetype) \
|
||||||
|
"File type: " + filetype + \
|
||||||
|
" is not allowed. Only PNG, JPEG, and WEBP are allowed!"
|
||||||
|
#define COMMAND_GENERATE_REPORT_FAIL_IMAGE_LOAD \
|
||||||
|
"Failed to load the background image! Aborting. You were not changed for " \
|
||||||
|
"this."
|
||||||
|
|
||||||
// Command get_pfp
|
// Command get_pfp
|
||||||
#define COMMAND_GET_PFP "get_pfp"
|
#define COMMAND_GET_PFP "get_pfp"
|
||||||
|
@@ -23,13 +23,14 @@ void commandGenerateReport(const dpp::slashcommand_t &event,
|
|||||||
std::get<dpp::snowflake>(event.get_parameter("image"));
|
std::get<dpp::snowflake>(event.get_parameter("image"));
|
||||||
dpp::attachment file = event.command.get_resolved_attachment(fileId);
|
dpp::attachment file = event.command.get_resolved_attachment(fileId);
|
||||||
auto fileType = supportedImageFileTypes.find(file.content_type);
|
auto fileType = supportedImageFileTypes.find(file.content_type);
|
||||||
|
|
||||||
if (fileType != supportedImageFileTypes.end()) {
|
if (fileType != supportedImageFileTypes.end()) {
|
||||||
bot.request(
|
bot.request(
|
||||||
file.url, dpp::http_method::m_get,
|
file.url, dpp::http_method::m_get,
|
||||||
[event, &bot, fileType](const dpp::http_request_completion_t &result) {
|
[event, &bot, fileType](const dpp::http_request_completion_t &result) {
|
||||||
auto imageAsSurface = fileType->second(result.body);
|
auto imageAsSurface = fileType->second(result.body);
|
||||||
if (imageAsSurface == nullptr) {
|
if (imageAsSurface == nullptr) {
|
||||||
event.edit_response("Failed to load the background image :(");
|
event.edit_response(COMMAND_GENERATE_REPORT_FAIL_IMAGE_LOAD);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +50,7 @@ void commandGenerateReport(const dpp::slashcommand_t &event,
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
event.edit_response(
|
event.edit_response(
|
||||||
"File type: " + file.content_type +
|
COMMAND_GENERATE_REPORT_FAIL_NOT_SUPPORTED(file.content_type));
|
||||||
" is not allowed. Only PNG, JPEG, and WEBP are allowed!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user