Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在代码中使用telegraf内联菜单模块_Node.js_Telegraf - Fatal编程技术网

Node.js 如何在代码中使用telegraf内联菜单模块

Node.js 如何在代码中使用telegraf内联菜单模块,node.js,telegraf,Node.js,Telegraf,嗨,我有这样一个代码: const Telegraf = require('telegraf'); const TelegrafInlineMenu = require('telegraf-inline-menu'); const bot = new Telegraf(process.env.BOT_TOKEN); const menu = new TelegrafInlineMenu('menu'); menu.setCommand('list'); menu.simpleButton('

嗨,我有这样一个代码:

const Telegraf = require('telegraf');
const TelegrafInlineMenu = require('telegraf-inline-menu');

const bot = new Telegraf(process.env.BOT_TOKEN);

const menu = new TelegrafInlineMenu('menu');
menu.setCommand('list');
menu.simpleButton('I am excited', 'a', {
    doFunc: ctx => ctx.reply('as I am')
});
bot.on('text', (ctx) => {
    if(ctx.message.text == 'list') {
      // i want to run my inline menu here
  }
});
bot.startPolling();
实际上,当用户发送'list'命令时,我想用内联菜单显示文本。 如何运行注释所在的内联菜单? 我编写了
bot.use(menu.init())
,但它不起作用


谢谢你的帮助

您忘记启动bot了吗

bot.use(menu.init());
bot.launch();