add /rainbow and /rainbowme Slash Commands

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-05-12 16:36:43 +01:00
parent 3161682836
commit 8bd45ce893
2 changed files with 88 additions and 0 deletions

View file

@ -30,6 +30,7 @@ import MultiInviter from './utils/MultiInviter';
import { linkifyAndSanitizeHtml } from './HtmlUtils';
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
import WidgetUtils from "./utils/WidgetUtils";
import {textToHtmlRainbow} from "./utils/colour";
class Command {
constructor({name, args='', description, runFn, hideCompletionAfterSpace=false}) {
@ -718,6 +719,26 @@ export const CommandMap = {
return success();
},
}),
rainbow: new Command({
name: "rainbow",
description: _td(""),
args: '<message>',
runFn: function(roomId, args) {
if (!args) return reject(this.getUserId());
return success(MatrixClientPeg.get().sendHtmlMessage(roomId, args, textToHtmlRainbow(args)));
},
}),
rainbowme: new Command({
name: "rainbowme",
description: _td(""),
args: '<message>',
runFn: function(roomId, args) {
if (!args) return reject(this.getUserId());
return success(MatrixClientPeg.get().sendHtmlEmote(roomId, args, textToHtmlRainbow(args)));
},
})
};
/* eslint-enable babel/no-invalid-this */