Separated the join instructions into a executeJoinCommand method

This commit is contained in:
Kaki In 2022-07-27 12:21:00 +02:00
parent f9f49b7640
commit 550b9db4dc

View file

@ -198,15 +198,7 @@ export class RoomViewModel extends ViewModel {
}
}
async _processCommand (message) {
let msgtype = undefined;
const [commandName, ...args] = message.substring(1).split(" ");
switch (commandName) {
case "me":
message = args.join(" ");
msgtype = "m.emote";
break;
case "join":
async executeJoinCommand(args) {
if (args.length == 1) {
let roomName = args[0];
try {
@ -231,6 +223,18 @@ export class RoomViewModel extends ViewModel {
this._timelineError = null;
this.emitChange("error");
}
}
async _processCommand (message) {
let msgtype = undefined;
const [commandName, ...args] = message.substring(1).split(" ");
switch (commandName) {
case "me":
message = args.join(" ");
msgtype = "m.emote";
break;
case "join":
await this.executeJoinCommand(args);
break;
case "shrug":
message = "¯\\_(ツ)_/¯ " + args.join(" ");