Closed ryznxx closed 2 years ago
ERROR SENDING BUTTON IMAGE so i decided to add button message with image headerType: 4 but suddenly i got error and error again i didn't know why the heck this can't run the image message button.
i try running it on vps and termux.
BaileysError: Unexpected status in 'action': Bad Request(400) at WAConnection.query (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/0.Base.js:237:27) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async WAConnection.relayWAMessage (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/6.MessagesSend.js:315:13) at async WAConnection.sendMessage (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/6.MessagesSend.js:25:9) at async WAConnection.handler (/data/data/com.termux/files/home/games-wabot/handler.js:383:13) { status: 400, context: { query: [ 'action', [Object], [Array] ], message: 'Bad Request', status: 400 } }
then i try it on my desktop i got same error 😕
Your code?
ERROR SENDING BUTTON IMAGE so i decided to add button message with image headerType: 4 but suddenly i got error and error again i didn't know why the heck this can't run the image message button. i try running it on vps and termux.
BaileysError: Unexpected status in 'action': Bad Request(400) at WAConnection.query (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/0.Base.js:237:27) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async WAConnection.relayWAMessage (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/6.MessagesSend.js:315:13) at async WAConnection.sendMessage (/data/data/com.termux/files/home/games-wabot/node_modules/@adiwajshing/baileys/lib/WAConnection/6.MessagesSend.js:25:9) at async WAConnection.handler (/data/data/com.termux/files/home/games-wabot/handler.js:383:13) { status: 400, context: { query: [ 'action', [Object], [Array] ], message: 'Bad Request', status: 400 } }
then i try it on my desktop i got same error 😕
Your code?
let handler = async (m, { conn, usedPrefix }) => { let txt = 'test the button images' const buttons = [ {buttonId:
/menu
, buttonText: {displayText: 'MENU'}, type: 1}, {buttonId:/ping
, buttonText: {displayText: 'PING'}, type: 1} ] const media = await conn.prepareMessageMedia(fs.readFileSync('./src/example.jpeg'), MessageType.image) const buttonMessage = { contentText: txt, footerText: '©games-wabot', buttons: buttons, headerType: 4, imageMessage: media, } return conn.sendMessage(m.chat, buttonMessage, MessageType.buttonsMessage, { quoted: m })
}
let fs = require('fs') let { MessageType } = require('@adiwajshing/baileys') let handler = async (m, { conn, usedPrefix }) => { let txt = 'test the button images' const buttons = [ {buttonId:
/menu
, buttonText: {displayText: 'MENU'}, type: 1}, {buttonId:/ping
, buttonText: {displayText: 'PING'}, type: 1} ] const media = await conn.prepareMessageMedia(fs.readFileSync('./src/example.jpeg'), MessageType.image) const buttonMessage = { contentText: txt, footerText: '©games-wabot', buttons: buttons, headerType: 4, imageMessage: media, } return conn.sendMessage(m.chat, buttonMessage, MessageType.buttonsMessage, { quoted: m })}
handler.command = /^buttimage/i module.exports = handler
full codes
let fs = require('fs') let { MessageType } = require('@adiwajshing/baileys') let handler = async (m, { conn, usedPrefix }) => { let txt = 'test the button images' const buttons = [ {buttonId:
/menu
, buttonText: {displayText: 'MENU'}, type: 1}, {buttonId:/ping
, buttonText: {displayText: 'PING'}, type: 1} ] const media = await conn.prepareMessageMedia(fs.readFileSync('./src/example.jpeg'), MessageType.image) const buttonMessage = { contentText: txt, footerText: '©games-wabot', buttons: buttons, headerType: 4, imageMessage: media, } return conn.sendMessage(m.chat, buttonMessage, MessageType.buttonsMessage, { quoted: m })}
handler.command = /^buttimage/i module.exports = handler
full codes
const fs = require('fs')
let handler = async (m, { conn, usedPrefix }) => {
let txt = 'test the button images'
const buttons = [
['MENU', '/menu'],
['PING', '/ping']
]
return conn.sendButton(m.chat, txt, '©games-wabot', fs.readFileSync('./src/example.jpeg'), buttons, { quoted: m })
}
i forgot to read the simple.js 😂 thanks man.
ERROR SENDING BUTTON IMAGE so i decided to add button message with image headerType: 4 but suddenly i got error and error again i didn't know why the heck this can't run the image message button.
i try running it on vps and termux.
then i try it on my desktop i got same error 😕