diff --git a/bin/config_sample/config.ini b/bin/config_sample/config.ini index dcbff37..2b7c327 100644 --- a/bin/config_sample/config.ini +++ b/bin/config_sample/config.ini @@ -30,3 +30,4 @@ max_dice=100 webhook_enabled=false webhook_url=Your webhook url here. webhook_sendfile=false +webhook_content= diff --git a/core/include/server.h b/core/include/server.h index c76417b..35c8c00 100644 --- a/core/include/server.h +++ b/core/include/server.h @@ -317,11 +317,17 @@ class Server : public QObject { * @brief The minimum time between IC messages, in milliseconds. */ int message_floodguard; + /** * @brief URL send to the client during handshake to set the remote repository URL. */ QUrl asset_url; + /** + * @brief Opional text to be send with the Discord embeed. Can be used to configure pings. + */ + QString webhook_content; + public slots: /** * @brief Handles a new connection. diff --git a/core/src/discord.cpp b/core/src/discord.cpp index b502598..de97e20 100644 --- a/core/src/discord.cpp +++ b/core/src/discord.cpp @@ -42,6 +42,8 @@ void Discord::postModcallWebhook(QString name, QString reason, int current_area) }; jsonArray.append(jsonObject); json["embeds"] = jsonArray; + if (!server->webhook_content.isEmpty()) + json["content"] = server->webhook_content; nam->post(request, QJsonDocument(json).toJson()); diff --git a/core/src/server.cpp b/core/src/server.cpp index ac1963e..8af3463 100644 --- a/core/src/server.cpp +++ b/core/src/server.cpp @@ -311,6 +311,7 @@ void Server::loadServerConfig() webhook_enabled = config.value("webhook_enabled", "false").toBool(); webhook_url = config.value("webhook_url", "Your webhook url here.").toString(); webhook_sendfile = config.value("webhook_sendfile", false).toBool(); + webhook_content = config.value("webhook_content", "").toString(); config.endGroup(); }