Separated the join instructions into a executeJoinCommand method
This commit is contained in:
parent
f9f49b7640
commit
550b9db4dc
1 changed files with 28 additions and 24 deletions
|
@ -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(" ");
|
||||||
|
|
Reference in a new issue