简体   繁体   中英

telegraf.js bot does not respond in group

I use very basic Telegram bot. The response are working very well when directly message to bot. At the same time the bot only respond for commands in the group.

Is there any option to work all the bot features with in group ?

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

By default, bots in Telegram group chats are placed into privacy mode -- they will only receive callbacks for messages which contain /commands or which are replies to the bot's own message. (They will also receive callbacks for service messages, like when users join or leave the group.)

A group admin will need to disable privacy mode for the bot to receive all messages in the group.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM