diff --git a/src/actionshandler.cpp b/src/actionshandler.cpp
index baedc03d3..f5b7db78c 100644
--- a/src/actionshandler.cpp
+++ b/src/actionshandler.cpp
@@ -128,6 +128,7 @@ void ActionsHandler::postMessage(const QString &text,
static const QString htmlPrefix = QStringLiteral("/html "); // TODO
static const QString rainbowPrefix = QStringLiteral("/rainbow ");
static const QString rainbowmePrefix = QStringLiteral("/rainbowme ");
+ static const QString spoilerPrefix = QStringLiteral("/spoiler ");
static const QString mePrefix = QStringLiteral("/me ");
static const QString noticePrefix = QStringLiteral("/notice ");
@@ -178,6 +179,14 @@ void ActionsHandler::postMessage(const QString &text,
return;
}
+ if (cleanedText.indexOf(spoilerPrefix) == 0) {
+ cleanedText = cleanedText.remove(0, spoilerPrefix.length());
+ const QStringList splittedText = rawText.split(" ");
+ QString spoilerHtml = QStringLiteral("") % preprocess(cleanedText) % QStringLiteral("");
+ m_room->postHtmlMessage(cleanedText, spoilerHtml, RoomMessageEvent::MsgType::Notice, replyEventId, editEventId);
+ return;
+ }
+
if (cleanedText.indexOf(rainbowmePrefix) == 0) {
cleanedText = cleanedText.remove(0, rainbowmePrefix.length());
QString rainbowText;
diff --git a/src/commandmodel.cpp b/src/commandmodel.cpp
index bb34146a4..53408cd13 100644
--- a/src/commandmodel.cpp
+++ b/src/commandmodel.cpp
@@ -65,6 +65,11 @@ QVariantList CommandModel::commands()
QStringLiteral(""),
i18n("Sends the given emote coloured as a rainbow")}));
+ commands.append(QVariant::fromValue(Command{
+ QStringLiteral("/spoiler "),
+ QStringLiteral(""),
+ i18n("Sends the given message as a spoiler")}));
+
// Actions commands
commands.append(QVariant::fromValue(Command{