BochilGaming / games-wabot

Games-wabot is RPG Bot Whatsapp. Now support Multi-device!!, check branch multi-device
http://bochil.ddns.net/
GNU General Public License v3.0
214 stars 509 forks source link

Bug sending button message #101

Closed ryznxx closed 2 years ago

ryznxx commented 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 😕

BochilGaming commented 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?

ryznxx commented 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?

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 })

}

ryznxx commented 2 years ago

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

BochilGaming commented 2 years ago

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 })
}
ryznxx commented 2 years ago

i forgot to read the simple.js 😂 thanks man.