From ce325d11828b6f32584b39e7e427aa47b0ee555d Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Fri, 10 May 2024 16:33:59 +0300 Subject: [PATCH] fix(master): linting warnings --- src/Socket/business.ts | 4 ++-- src/Socket/chats.ts | 10 +++++----- src/Socket/groups.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Socket/business.ts b/src/Socket/business.ts index dddb8b0..696c5f6 100644 --- a/src/Socket/business.ts +++ b/src/Socket/business.ts @@ -14,7 +14,7 @@ export const makeBusinessSocket = (config: SocketConfig) => { const getCatalog = async({ jid, limit, cursor }: GetCatalogOptions) => { jid = jid || authState.creds.me?.id - jid = jidNormalizedUser(jid!) + jid = jidNormalizedUser(jid) const queryParamNodes: BinaryNode[] = [ { @@ -65,7 +65,7 @@ export const makeBusinessSocket = (config: SocketConfig) => { const getCollections = async(jid?: string, limit = 51) => { jid = jid || authState.creds.me?.id - jid = jidNormalizedUser(jid!) + jid = jidNormalizedUser(jid) const result = await query({ tag: 'iq', attrs: { diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 5be14ca..4e586d1 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -42,7 +42,7 @@ export const makeChatsSocket = (config: SocketConfig) => { return key } - const fetchPrivacySettings = async(force: boolean = false) => { + const fetchPrivacySettings = async(force = false) => { if(!privacySettings || force) { const { content } = await query({ tag: 'iq', @@ -540,7 +540,7 @@ export const makeChatsSocket = (config: SocketConfig) => { const sendPresenceUpdate = async(type: WAPresence, toJid?: string) => { const me = authState.creds.me! if(type === 'available' || type === 'unavailable') { - if(!me!.name) { + if(!me.name) { logger.warn('no name present, ignoring presence update request...') return } @@ -550,7 +550,7 @@ export const makeChatsSocket = (config: SocketConfig) => { await sendNode({ tag: 'presence', attrs: { - name: me!.name, + name: me.name, type } }) @@ -558,7 +558,7 @@ export const makeChatsSocket = (config: SocketConfig) => { await sendNode({ tag: 'chatstate', attrs: { - from: me!.id!, + from: me.id, to: toJid!, }, content: [ @@ -840,7 +840,7 @@ export const makeChatsSocket = (config: SocketConfig) => { // update our pushname too if(msg.key.fromMe && msg.pushName && authState.creds.me?.name !== msg.pushName) { - ev.emit('creds.update', { me: { ...authState.creds.me!, name: msg.pushName! } }) + ev.emit('creds.update', { me: { ...authState.creds.me!, name: msg.pushName } }) } } diff --git a/src/Socket/groups.ts b/src/Socket/groups.ts index 2c7d949..226df38 100644 --- a/src/Socket/groups.ts +++ b/src/Socket/groups.ts @@ -165,8 +165,8 @@ export const makeGroupsSocket = (config: SocketConfig) => { }] ) const node = getBinaryNodeChild(result, 'membership_requests_action') - const nodeAction = getBinaryNodeChild(node!, action) - const participantsAffected = getBinaryNodeChildren(nodeAction!, 'participant') + const nodeAction = getBinaryNodeChild(node, action) + const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant') return participantsAffected.map(p => { return { status: p.attrs.error || '200', jid: p.attrs.jid } })