add support for emotes and running /commands

this does not yet include autocomplete for commands
This commit is contained in:
Bruno Windels
2019-08-22 13:33:20 +01:00
parent cc82353d8f
commit 88cc1c428d
3 changed files with 86 additions and 27 deletions
+12
View File
@@ -56,3 +56,15 @@ export function textSerialize(model) {
}
}, "");
}
export function containsEmote(model) {
const firstPart = model.parts[0];
return firstPart && firstPart.type === "plain" && firstPart.text.startsWith("/me ");
}
export function stripEmoteCommand(model) {
// trim "/me "
model = model.clone();
model.removeText({index: 0, offset: 0}, 4);
return model;
}