Skip to content

Commit

Permalink
fix(master): linting and making functionality better
Browse files Browse the repository at this point in the history
  • Loading branch information
PurpShell committed May 18, 2024
1 parent 51f18d8 commit 5ffa3a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Socket/chats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
const jid = attrs.from
const participant = attrs.participant || attrs.from

if(shouldIgnoreJid(jid) && jid != '@s.whatsapp.net') {
if(shouldIgnoreJid(jid) && jid !== '@s.whatsapp.net') {
return
}

Expand Down
14 changes: 7 additions & 7 deletions src/Socket/messages-recv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {

const handleNotification = async(node: BinaryNode) => {
const remoteJid = node.attrs.from
if(shouldIgnoreJid(remoteJid) && remoteJid != '@s.whatsapp.net') {
if(shouldIgnoreJid(remoteJid) && remoteJid !== '@s.whatsapp.net') {
logger.debug({ remoteJid, id: node.attrs.id }, 'ignored notification')
await sendMessageAck(node)
return
Expand Down Expand Up @@ -683,6 +683,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}

const handleMessage = async(node: BinaryNode) => {
if(shouldIgnoreJid(msg.key.remoteJid!) && msg.key.remoteJid! !== '@s.whatsapp.net') {

Check failure on line 686 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Block-scoped variable 'msg' used before its declaration.

Check failure on line 686 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Variable 'msg' is used before being assigned.

Check failure on line 686 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Block-scoped variable 'msg' used before its declaration.

Check failure on line 686 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Variable 'msg' is used before being assigned.
logger.debug({ key: msg.key }, 'ignored message')

Check failure on line 687 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Block-scoped variable 'msg' used before its declaration.

Check failure on line 687 in src/Socket/messages-recv.ts

View workflow job for this annotation

GitHub Actions / update-nightly

Variable 'msg' is used before being assigned.
await sendMessageAck(node)
return
}

const { fullMessage: msg, category, author, decrypt } = decryptMessageNode(
node,
authState.creds.me!.id,
Expand All @@ -697,12 +703,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
}

if(shouldIgnoreJid(msg.key.remoteJid!) && msg.key.remoteJid! != '@s.whatsapp.net') {
logger.debug({ key: msg.key }, 'ignored message')
await sendMessageAck(node)
return
}

await Promise.all([
processingMutex.mutex(
async() => {
Expand Down

0 comments on commit 5ffa3a5

Please sign in to comment.