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
commit b07b38bbe8

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