Baileys
Baileys copied to clipboard
[BUG] TypeError: Cannot read properties of undefined (reading 'isEmpty')
Describe the bug After a while with the #14 issue, the error has now changed
To Reproduce Steps to reproduce the behavior:
- Created a new connection.
- Tried to send a message.
Expected behavior The message is sent and the bot doesn't crash.
Environment (please complete the following information):
- Is this on a server? Yes
- What do your
connectOptions
look like?
makeWASocket({
...this.opts?.baileysOpts,
logger: P({ level: "silent" }),
auth: state,
browser: Browsers.appropriate("Desktop"),
getMessage: async (key) => {
const { id } = key;
return tempStore[id!]?.message!;
}
});
- Do you have multiple clients on the same IP? Not
- Are you using a proxy? Not
Additional context The error doesn't appear if I send the message on my own chat
you are getting the message incorrectly you should look for the specific message you could use like this in the example
async function getMessage(key: WAMessageKey): Promise<WAMessageContent | undefined> {
if(store) {
const msg = await store.loadMessage(key.remoteJid!, key.id!)
return msg?.message || undefined
}
// only if store is present
return proto.Message.fromObject({})
}
I'm using an object as store, thats why I'm getting it that way
Could you provide more information about the error? I'm not really understanding it.