Add roomavatar slash command to set avatar of the current room

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-09-18 16:33:56 +01:00
parent e18b38c409
commit 2632e648b4

View file

@ -259,6 +259,24 @@ export const CommandMap = {
category: CommandCategories.actions,
}),
roomavatar: new Command({
name: 'roomavatar',
args: '[<mxc_url>]',
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: '[<mxc_url>]',