@On('message')
async ban(@Message('text') text: string, @Ctx() ctx: Context) {
if (text === '✖️ Отмена') {
await ctx.deleteMessage(this.#messageId)
await ctx.deleteMessage()
await ctx.reply('✔️', adminButtons())
return ctx.scene.leave()
}
if (!Number(text)) return 'Только числа'
const isUser = await this.userService.byTgUserId(+text)
if (!isUser) return 'Пользователя нет в базе'
await ctx.deleteMessage(this.#messageId)
await ctx.deleteMessage()
await ctx.reply('✔️', adminButtons())
await ctx.banChatMember(+text)
// await this.userService.removeUser(+text)
return ctx.scene.leave()
}
I write a telegram bot with subscriptions with nestjs-telegraf, add the ability to ban the user of the telegram bot, get an error: Error: 400: Bad Request: can't ban members in private chats. I thought it would be logical to go to BotFather and make such a setting there if any, but I did not see it or missed it, looked through more details in the telegraf documentation methods for this task, tried it and did not get a positive result