Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Sep 21, 2021
1 parent 170ab45 commit 35a1c4a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
8 changes: 5 additions & 3 deletions src/api/layers/group.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@ export class GroupLayer extends RetrieverLayer {
public async getAllChatsGroups(groupId: string) {
return await this.page.evaluate(() => {
const chats = WAPI.getAllChats();
return (!groupId && !groupId.length && typeof groupId === 'string') ?
chats.filter((chat) => chat.kind === 'group') :
chats.filter((chat) => chat.kind === 'group' && groupId === chat.id._serialized);
return !groupId && !groupId.length && typeof groupId === 'string'
? chats.filter((chat) => chat.kind === 'group')
: chats.filter(
(chat) => chat.kind === 'group' && groupId === chat.id._serialized
);
});
}

Expand Down
46 changes: 25 additions & 21 deletions src/lib/wapi/functions/check-chat.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
export async function checkChat(id) {
try {
if (
typeof id === 'string' &&
(
id.includes('@g.us') ||
id.includes('@c.us') ||
id.includes('@broadcast')
)
) {
const chat = await Store.Chat.get(id);
if (!!chat && chat.t) {
return WAPI.scope(undefined, false, 200, null, WAPI._serializeChatObj(chat));
} else {
throw 404;
}
} else {
throw 400;
}
} catch (e) {
return WAPI.scope(undefined, true, e, 'Was not found');
try {
if (
typeof id === 'string' &&
(id.includes('@g.us') ||
id.includes('@c.us') ||
id.includes('@broadcast'))
) {
const chat = await Store.Chat.get(id);
if (!!chat && chat.t) {
return WAPI.scope(
undefined,
false,
200,
null,
WAPI._serializeChatObj(chat)
);
} else {
throw 404;
}
} else {
throw 400;
}
};
} catch (e) {
return WAPI.scope(undefined, true, e, 'Was not found');
}
}

0 comments on commit 35a1c4a

Please sign in to comment.