add support for emotes and running /commands

this does not yet include autocomplete for commands
This commit is contained in:
Bruno Windels 2019-08-21 11:26:21 +02:00
parent cc82353d8f
commit 88cc1c428d
3 changed files with 86 additions and 27 deletions

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;
}