2

I'm implementing moderation features for a telegram bot, part of it is that the bot should be able to ban a user from multiple groups / channels.

I implemented a command that adds the group it was issued in to a moderatedChats.json, which is just a list of chatIds. When it comes to the command /gban I want to iterate over this list and let the bot ban the user in each group.

Seems like telegraf's ctx.banChatMember() function only allows me to pass in the userid and automatically uses the chatid the command was issued in.

Any ideas what to do?

4b0
  • 21,981
  • 30
  • 95
  • 142

1 Answers1

0

You can use like this

bot = new Telegraf(bot_token);

bot.telegram.banChatMember(chatId, userId);

Please check line 529 (function banChatMember) of this link https://github.com/telegraf/telegraf/blob/v4/src/telegram.ts

Phat Tran
  • 3,404
  • 1
  • 19
  • 22