Coder Social home page Coder Social logo

Comments (5)

BochilGaming avatar BochilGaming commented on June 4, 2024 2

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

from games-wabot.

BochilGaming avatar BochilGaming commented on June 4, 2024

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?

from games-wabot.

ryznxx avatar ryznxx commented on June 4, 2024

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

}

from games-wabot.

ryznxx avatar ryznxx commented on June 4, 2024

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

from games-wabot.

ryznxx avatar ryznxx commented on June 4, 2024

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

from games-wabot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.