【发布时间】:2021-01-13 11:53:51
【问题描述】:
我想在 telegraf 中使用 webHook,但我不知道如何正确使用它。
这是我的简单代码。 但它仍然使用轮询。
const Telegraf = require('telegraf');
const bot = new Telegraf('123:ABC');
bot.telegram.setWebhook('https://myaddress.com');
bot.startWebhook(`/`, null, 4000);
bot.use(function(ctx, next){
try{
if(ctx.chat == undefined) return;
console.log("Hello World");
}catch (e){
console.log("Error");
}
});
bot.launch();
【问题讨论】:
标签: node.js telegraf.js