From 788e40f07680ff9c96fa3a0bebb7711fa30a9bbc Mon Sep 17 00:00:00 2001 From: chr Date: Mon, 18 Feb 2019 15:27:22 -0800 Subject: [PATCH] Add /shrug command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certain popular web-based chat systems support a `/shrug` command which appends the ¯\\_(ツ)_/¯ text emoticon (kaomoji) to a message. I've often found myself wishing Riot had something similar, so I decided to add it myself. (If Riot ever gets a user-extensible /-command system, this will probably no longer be necessary. But since it doesn't have that, here I am). Doesn't support markdown / rich text messages because I didn't want to dig that far into Riot/the SDKs for my first PR; if someone else would like to add that, by all means. Signed-off-by: Andrew Chronister --- src/SlashCommands.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index 115cf0e018..d675500f07 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -70,6 +70,19 @@ function success(promise) { /* eslint-disable babel/no-invalid-this */ export const CommandMap = { + shrug: new Command({ + name: 'shrug', + args: '', + description: _td('Prepends ¯\\_(ツ)_/¯ to a plain-text message'), + runFn: function(roomId, args) { + var message = '¯\\_(ツ)_/¯' + if (args) { + message = message + ' ' + args + } + return success(MatrixClientPeg.get().sendTextMessage(roomId, message)); + } + }), + ddg: new Command({ name: 'ddg', args: '',