mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: catch errors in example
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Boom } from '@hapi/boom'
|
import { Boom } from '@hapi/boom'
|
||||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, jidNormalizedUser, makeCacheableSignalKeyStore, makeInMemoryStore, MessageRetryMap, useMultiFileAuthState } from '../src'
|
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, makeCacheableSignalKeyStore, makeInMemoryStore, MessageRetryMap, useMultiFileAuthState } from '../src'
|
||||||
import MAIN_LOGGER from '../src/Utils/logger'
|
import MAIN_LOGGER from '../src/Utils/logger'
|
||||||
|
|
||||||
const logger = MAIN_LOGGER.child({ })
|
const logger = MAIN_LOGGER.child({ })
|
||||||
@@ -147,7 +147,9 @@ const startSock = async() => {
|
|||||||
if(events['contacts.update']) {
|
if(events['contacts.update']) {
|
||||||
for(const contact of events['contacts.update']) {
|
for(const contact of events['contacts.update']) {
|
||||||
if(typeof contact.imgUrl !== 'undefined') {
|
if(typeof contact.imgUrl !== 'undefined') {
|
||||||
const newUrl = contact.imgUrl === null ? null : await sock!.profilePictureUrl(contact.id!)
|
const newUrl = contact.imgUrl === null
|
||||||
|
? null
|
||||||
|
: await sock!.profilePictureUrl(contact.id!).catch(() => null)
|
||||||
console.log(
|
console.log(
|
||||||
`contact ${contact.id} has a new profile pic: ${newUrl}`,
|
`contact ${contact.id} has a new profile pic: ${newUrl}`,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user