WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API

Home Page:https://baileys.whiskeysockets.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] how to solve conn.decodeJid is not A function

ilmanhdyt opened this issue · comments

here is my conn.decodeJid function

conn.decodeJid = (jid) => {
if (!jid) return jid
if (/:\d+@/gi.test(jid)) {
let decode = jidDecode(jid) || {}
return decode.user && decode.server && decode.user + '@' + decode.server || jid
} else return jid
}
if (conn.user && conn.user.id) conn.user.jid = conn.decodeJid(conn.user.id)
conn.chats = {}
conn.contacts = {}

and here is the code that requires conn.decodeJid

exports.smsg = (conn, m, hasParent) => {
if (!m) return m
let M = proto.WebMessageInfo
m = M.fromObject(m)
if (m.key) {
m.id = m.key.id
m.isBaileys = m.id && m.id.length === 16 || m.id.startsWith('3EB0') && m.id.length === 12 || false
m.chat = conn.decodeJid(m.key.remoteJid || message.message?.senderKeyDistributionMessage?.groupId || '')
m.isGroup = m.chat.endsWith('@g.us')
m.sender = conn.decodeJid(m.key.fromMe && conn.user.id || m.participant || m.key.participant || m.chat || '')
m.fromMe = m.key.fromMe || areJidsSameUser(m.sender, conn.user.id)
}

have a solution?here is my repo
https://github.com/ilmanhdyt/ShiraoriBOT-Md/blob/Multi-Device/lib/simple.js

commented

bug??????? ?????????

????????????????????????????????????????????????????????????