Closed danillo10 closed 1 year ago
When i click on buttons the bot get no response...
import chalk from "chalk"; import String from "../lib/db.js"; import * as Carbon from "unofficial-carbon-now"; import inputSanitization from "../sidekick/input-sanitization"; import format from "string-format"; import Client from "../sidekick/client.js"; import BotsApp from "../sidekick/sidekick"; import { MessageType } from "../sidekick/message-type"; import { proto } from "@adiwajshing/baileys"; import Command from "../sidekick/command"; const CARBON = String.carbon; const HELP = String.help; module.exports = { name: "noticias", description: CARBON.DESCRIPTION, extendedDescription: CARBON.EXTENDED_DESCRIPTION, demo: { isEnabled: true, text: [ ".noticias Hi! Welcome to BotsApp.", '.noticias #include <iostream> \nint main() \n{\n std::cout << "Hello BotsApp!"; \n return 0;\n} -t yeti', ".noticias -t", ], }, async handle(client: Client, chat: proto.IWebMessageInfo, BotsApp: BotsApp, args: string[], commandHandler: Map<string, Command>): Promise<void> { try { var buttons: proto.IButton[] = []; var i = 0; const messages = [ '.yt ronaldinho gaucho', '.yt ronaldinho', '.yt good vibes' ] messages.map((message: string) => { var button: proto.IButton = { buttonId: 'id' + i++, buttonText: {displayText: message}, type: 1 } buttons.push(button); }) const buttonMessage = { text: 'Qual tipo de notícia você deseja ?', buttons: buttons, headerType: 1 } const res = await client.sendMessage(BotsApp.chatId, buttonMessage, MessageType.buttonsMessage).catch(err => inputSanitization.handleError(err, client, BotsApp)) return; } catch (err) { await inputSanitization.handleError(err, client, BotsApp); } }, };
When i click on buttons the bot get no response...