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