mirror of https://github.com/vector-im/riot-web
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>pull/21833/head
parent
07f49e8ddb
commit
788e40f076
|
@ -70,6 +70,19 @@ function success(promise) {
|
||||||
/* eslint-disable babel/no-invalid-this */
|
/* eslint-disable babel/no-invalid-this */
|
||||||
|
|
||||||
export const CommandMap = {
|
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({
|
ddg: new Command({
|
||||||
name: 'ddg',
|
name: 'ddg',
|
||||||
args: '<query>',
|
args: '<query>',
|
||||||
|
|
Loading…
Reference in New Issue