From 2632e648b4a485a25c4092e570233a7b3e064b05 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 16:33:56 +0100 Subject: [PATCH] Add roomavatar slash command to set avatar of the current room Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/SlashCommands.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index 2d5617f8f0..65f7f008f6 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -259,6 +259,24 @@ export const CommandMap = { category: CommandCategories.actions, }), + roomavatar: new Command({ + name: 'roomavatar', + args: '[]', + description: _td('Changes the avatar of the current room'), + runFn: function(roomId, args) { + let promise = Promise.resolve(args); + if (!args) { + promise = singleMxcUpload(); + } + + return success(promise.then((url) => { + if (!url) return; + return MatrixClientPeg.get().sendStateEvent(this.props.roomId, 'm.room.avatar', {url}, ''); + })); + }, + category: CommandCategories.actions, + }), + myroomavatar: new Command({ name: 'myroomavatar', args: '[]',