Merge pull request #190 from Salanto/fix-DiscordNoContentEmbed

Fix Modcall Embed Construction Order
This commit is contained in:
Rosemary Witchaven 2021-08-19 18:30:11 -05:00 committed by GitHub
commit 72aeee3ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -217,7 +217,7 @@ class ConfigManager {
* *
* @return See short description. * @return See short description.
*/ */
static QString discordWebhookContent(); static QString discordModcallWebhookContent();
/** /**
* @brief Returns true if the discord webhook should send log files. * @brief Returns true if the discord webhook should send log files.

View File

@ -17,6 +17,8 @@
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
#include "include/config_manager.h" #include "include/config_manager.h"
#include <include/config_manager.h>
QSettings* ConfigManager::m_settings = new QSettings("config/config.ini", QSettings::IniFormat); QSettings* ConfigManager::m_settings = new QSettings("config/config.ini", QSettings::IniFormat);
QSettings* ConfigManager::m_discord = new QSettings("config/discord.ini", QSettings::IniFormat); QSettings* ConfigManager::m_discord = new QSettings("config/discord.ini", QSettings::IniFormat);
ConfigManager::CommandSettings* ConfigManager::m_commands = new CommandSettings(); ConfigManager::CommandSettings* ConfigManager::m_commands = new CommandSettings();
@ -285,9 +287,9 @@ QString ConfigManager::discordModcallWebhookUrl()
return m_discord->value("Discord/webhook_modcall_url", "").toString(); return m_discord->value("Discord/webhook_modcall_url", "").toString();
} }
QString ConfigManager::discordWebhookContent() QString ConfigManager::discordModcallWebhookContent()
{ {
return m_discord->value("Discord/webhook_content", "").toString(); return m_discord->value("Discord/webhook_modcall_content", "").toString();
} }
bool ConfigManager::discordModcallWebhookSendFile() bool ConfigManager::discordModcallWebhookSendFile()

View File

@ -71,9 +71,11 @@ QJsonDocument Discord::constructModcallJson(const QString &f_name, const QString
{"description", f_reason} {"description", f_reason}
}; };
l_array.append(l_object); l_array.append(l_object);
if (!ConfigManager::discordModcallWebhookContent().isEmpty())
l_json["content"] = ConfigManager::discordModcallWebhookContent();
l_json["embeds"] = l_array; l_json["embeds"] = l_array;
if (!ConfigManager::discordWebhookContent().isEmpty())
l_json["content"] = ConfigManager::discordWebhookContent();
return QJsonDocument(l_json); return QJsonDocument(l_json);
} }