feat: Simulate recording audio in chat, clear recording/typing state, standardize chatstate change function names

This commit is contained in:
Pedro Lopez
2020-02-29 14:07:47 -04:00
parent d35f101fac
commit b07b38bbe8
3 changed files with 47 additions and 6 deletions

View File

@@ -256,8 +256,21 @@ exports.LoadUtils = () => {
return false;
};
window.WWebJS.typing = async (chatId) => {
await window.Store.Wap.sendChatstateComposing(chatId);
window.WWebJS.sendChatstate = async (state, chatId) => {
switch(state) {
case 'typing':
await window.Store.Wap.sendChatstateComposing(chatId);
break;
case 'recording':
await window.Store.Wap.sendChatstateRecording(chatId);
break;
case 'stop':
await window.Store.Wap.sendChatstatePaused(chatId);
break;
default:
throw 'Invalid chatstate';
}
return true;
};