首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >telegraf.js bot在群中不响应

telegraf.js bot在群中不响应
EN

Stack Overflow用户
提问于 2018-08-16 22:13:38
回答 1查看 1.9K关注 0票数 1

我用的是非常基本的电报机器人。当直接向bot发送消息时,响应非常好。同时,bot只对组中的命令作出响应。

有任何选项可以使用所有的bot特性吗?

代码语言:javascript
复制
const config = require('./config.json')
const Telegraf = require('telegraf')
const bot = new Telegraf(config.token);


bot.start((ctx) => ctx.reply('Welcome'))
bot.help((ctx) => ctx.reply('Send me a sticker'))
bot.on('sticker', (ctx) => ctx.reply(''))
bot.hears('hi', (ctx) => ctx.reply('Hey there'))
bot.hears(/buy/i, (ctx) => ctx.reply('Buy-buy'))

bot.command('oldschool', (ctx) => ctx.reply('Hello'))
bot.command('modern', ({ reply }) => reply('Yo'))
bot.command('hipster', Telegraf.reply('λ'))


bot.startPolling()
EN

回答 1

Stack Overflow用户

发布于 2018-08-16 23:01:29

默认情况下,电报组聊天中的机器人被放置在隐私模式中--它们只接收包含/commands或对机器人自身消息的回复的消息的回调。(它们还将接收服务消息的回调,比如用户加入或离开组时。)

组管理员需要禁用机器人的隐私模式以接收组中的所有消息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51886000

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档