mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: jidNormalizedUser should not throw TypeError
This commit is contained in:
@@ -53,7 +53,12 @@ export const isJidGroup = (jid: string | undefined) => (jid?.endsWith('@g.us'))
|
||||
/** is the jid the status broadcast */
|
||||
export const isJidStatusBroadcast = (jid: string) => jid === 'status@broadcast'
|
||||
|
||||
export const jidNormalizedUser = (jid: string) => {
|
||||
const { user, server } = jidDecode(jid)!
|
||||
export const jidNormalizedUser = (jid: string | undefined) => {
|
||||
const result = jidDecode(jid)
|
||||
if(!result) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const { user, server } = result
|
||||
return jidEncode(user, server === 'c.us' ? 's.whatsapp.net' : server as JidServer)
|
||||
}
|
||||
Reference in New Issue
Block a user