diff --git a/src/api/gramjs/methods/messages.ts b/src/api/gramjs/methods/messages.ts index 4f8be32de..01bfccdde 100644 --- a/src/api/gramjs/methods/messages.ts +++ b/src/api/gramjs/methods/messages.ts @@ -734,12 +734,17 @@ export async function sendMessageAction({ return undefined; } - const result = await invokeRequest(new GramJs.messages.SetTyping({ - peer: buildInputPeer(peer.id, peer.accessHash), - topMsgId: threadId, - action: gramAction, - })); - return result; + try { + const result = await invokeRequest(new GramJs.messages.SetTyping({ + peer: buildInputPeer(peer.id, peer.accessHash), + topMsgId: threadId, + action: gramAction, + }), undefined, true); + return result; + } catch (error) { + // Prevent error from being displayed in UI + } + return undefined; } export async function markMessageListRead({ diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index d1f390285..03808f2a2 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -75,7 +75,9 @@ import { import { debounce, onTickEnd, rafPromise, } from '../../../util/schedulers'; -import { getMessageOriginalId, getUserFullName, isServiceNotificationMessage } from '../../helpers'; +import { + getMessageOriginalId, getUserFullName, isDeletedUser, isServiceNotificationMessage, isUserBot, +} from '../../helpers'; import { getTranslation } from '../../../util/langProvider'; import { ensureProtocol } from '../../../util/ensureProtocol'; @@ -332,6 +334,8 @@ addActionHandler('saveDraft', (global, actions, payload) => { const { text, entities } = draft; const chat = selectChat(global, chatId)!; + const user = selectUser(global, chatId)!; + if (user && isDeletedUser(user)) return undefined; if (threadId === MAIN_THREAD_ID) { void callApi('saveDraft', { @@ -484,6 +488,8 @@ addActionHandler('sendMessageAction', async (global, actions, payload) => { const chat = selectChat(global, chatId)!; if (!chat) return; + const user = selectUser(global, chatId); + if (user && (isUserBot(user) || isDeletedUser(user))) return; await callApi('sendMessageAction', { peer: chat, threadId, action,