Add /shrug command

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 <chr@chronal.net>
This commit is contained in:
chr 2019-02-18 15:27:22 -08:00 committed by Andrew Chronister
parent 07f49e8ddb
commit 788e40f076

View file

@ -70,6 +70,19 @@ function success(promise) {
/* eslint-disable babel/no-invalid-this */
export const CommandMap = {
shrug: new Command({
name: 'shrug',
args: '<message>',
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: '<query>',