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