support table flipping and unflipping
This commit is contained in:
@@ -124,6 +124,8 @@ void ActionsHandler::postMessage(const QString &text,
|
||||
// Message commands
|
||||
static const QString shrugPrefix = QStringLiteral("/shrug");
|
||||
static const QString lennyPrefix = QStringLiteral("/lenny");
|
||||
static const QString tableflipPrefix = QStringLiteral("/tableflip");
|
||||
static const QString unflipPrefix = QStringLiteral("/unflip");
|
||||
static const QString plainPrefix = QStringLiteral("/plain "); // TODO
|
||||
static const QString htmlPrefix = QStringLiteral("/html "); // TODO
|
||||
static const QString rainbowPrefix = QStringLiteral("/rainbow ");
|
||||
@@ -169,6 +171,18 @@ void ActionsHandler::postMessage(const QString &text,
|
||||
return;
|
||||
}
|
||||
|
||||
if (cleanedText.indexOf(tableflipPrefix) == 0) {
|
||||
cleanedText = QStringLiteral("(╯°□°)╯︵ ┻━┻") % cleanedText.remove(0, tableflipPrefix.length());
|
||||
m_room->postHtmlMessage(cleanedText, cleanedText, messageEventType, replyEventId, editEventId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cleanedText.indexOf(unflipPrefix) == 0) {
|
||||
cleanedText = QStringLiteral("┬──┬ ノ( ゜-゜ノ)") % cleanedText.remove(0, unflipPrefix.length());
|
||||
m_room->postHtmlMessage(cleanedText, cleanedText, messageEventType, replyEventId, editEventId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cleanedText.indexOf(rainbowPrefix) == 0) {
|
||||
cleanedText = cleanedText.remove(0, rainbowPrefix.length());
|
||||
QString rainbowText;
|
||||
|
||||
@@ -45,6 +45,16 @@ QVariantList CommandModel::commands()
|
||||
QStringLiteral("<message>"),
|
||||
i18n("Prepends ( ͡° ͜ʖ ͡°) to a plain-text message")}));
|
||||
|
||||
commands.append(QVariant::fromValue(Command{
|
||||
QStringLiteral("/tableflip "),
|
||||
QStringLiteral("<message>"),
|
||||
i18n("Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message")}));
|
||||
|
||||
commands.append(QVariant::fromValue(Command{
|
||||
QStringLiteral("/unflip "),
|
||||
QStringLiteral("<message>"),
|
||||
i18n("Prepends ┬──┬ ノ( ゜-゜ノ) to a plain-text message")}));
|
||||
|
||||
commands.append(QVariant::fromValue(Command{
|
||||
QStringLiteral("/plain "),
|
||||
QStringLiteral("<message>"),
|
||||
|
||||
@@ -116,7 +116,7 @@ static bool isSpellcheckable(const QStringRef &token)
|
||||
return false;
|
||||
}
|
||||
// part of a slash command
|
||||
if (token.contains("rainbowme") || token.contains("lenny")) {
|
||||
if (token.contains("rainbowme") || token.contains("lenny") || token.contains("tableflip") || token.contains("unflip")) {
|
||||
return false;
|
||||
}
|
||||
// TODO ignore urls and uppercase?
|
||||
|
||||
Reference in New Issue
Block a user