question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kick the bot from a group

See original GitHub issue

I was wondering if there’s a way to kick the bot from a group when added

I implemented my custom check to verify that a chat (group/channel) is allowed to have the bot in it and if the verification fails I would like the bot to kick itself from the chat

I found this

bot.execute(new KickChatMember(chatId, userId));

but i don’t think that this will help me at all or am I wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nautilorcommented, Oct 1, 2020

No, bot can not kick itself You can add other bot which will be responsible for kicking only 😃

there’s a telegram API call as far as I know called https://api.telegram.org/bot/leaveChat where you can specify the chat_id of the chat to leave

you can find more at https://core.telegram.org/bots/api#leavechat

The problem here is that I would like people to not add my bot to their group/channels and I found this call in the telegram api but not here in the java library

0reactions
nautilorcommented, Oct 1, 2020

Yes but I am doing a filter on allowed chat manually to see if the bot should be in a group and the LeaveChat works perfectly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kick a Chat Member with the Telegram Bot API - Pipedream
Use this method to kick a user from a group, a supergroup or channel. [See the docs](https://core.telegram.org/bots/api#banchatmember) for more information.
Read more >
How to auto remove/kick members from telegram channel or ...
Is there any way to do this task automatically, I mean can we remove/kick user from channel/group automatically or by scheduling? Any sample ......
Read more >
How do I remove a bot from a group? : r/TelegramBots - Reddit
Yep, just like a normal persoon, use the kick button.
Read more >
Add or remove people & bots from a space or group - Android
Add or remove people & bots from a space or group · Open the Chat app · Open a space or group conversation....
Read more >
Kick All Members (@prkickallbot) Telegram Bot
This Bot Can Kick All Members From Your Group Must Start The Bot (Telegram Bot)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found