Can telegram bot be configured to allow only one user to add the bot to a group?

161 views Asked by At

I'm making a Telegram Bot with aiogram3 and I need to make bot to be addable to groups only by admin of my bot. Is there any way to do it?

I tried code below but it only works for private chats.

@dp.chat_join_request()
async def request_handler(update: types.ChatJoinRequest):
    await update.decline()
1

There are 1 answers

0
0stone0 On

No thats not possible.

A group owner can add a bot the group.

The bot could however catch the join update and call leaveChat to leave it if it's not whitelisted;

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.