TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.22k stars 691 forks source link

Add "Forbidden: bot was kicked from the group chat" exception #662

Closed karb0f0s closed 6 years ago

karb0f0s commented 6 years ago

HTTP code: 403 Error message:

You receive this error if you add bot to group, remove it, and try to send message to that group afterwards

karb0f0s commented 6 years ago

I see two possible test runs for this exception:

karb0f0s commented 6 years ago

For my test case I created 3 groups in which I added and then removed my testbot:

long[] groups =
{
  -1001100532129, // BotBlockedSupergroup
  -1001298749133, // BotBlockedGroup
  -262679471, // BotBlockedChannel
};

after upgrading BotBlockedSupergroup from regular group to supergroup I caught a Bad Request: group chat was upgraded to a supergroup chat error

karb0f0s commented 6 years ago

I'd like to commit the tests with fixed chatIds, and maybe move them to settings/class fixture later. Is this appropriate?

tuscen commented 6 years ago

I'm okay with more interactivity during integ tests because some of them couldn't really be done either without more configs (several group chats and channels for different tests, etc) or without user interaction. But @pouladpld have different opinion on this.

karb0f0s commented 6 years ago

@Tuscen Sergey Khabibullin unofficially created a wrapper classes for TDLib and published them as NuGet package TDLib. I'm planning to add Telegram client features to tests, so we do not have to wait for user interactions, but send actions through TDLib.

tuscen commented 6 years ago

@karb0f0s Nice. It would be super helpful 👍

karb0f0s commented 6 years ago

This issue was moved to TelegramBots/Telegram.Bot.Extensions.Exceptions#2

sid-khullar commented 3 years ago

Hi. I'm not sure if this is the right place, but I'm at a loss for options. My bot receives the "bot was kicked from the supergroup chat" when it tries to send a message to a group it used to be a part of, was removed and then added again as an admin. Privacy mode is disabled.

PM84 commented 3 years ago

Hi. I'm not sure if this is the right place, but I'm at a loss for options. My bot receives the "bot was kicked from the supergroup chat" when it tries to send a message to a group it used to be a part of, was removed and then added again as an admin. Privacy mode is disabled.

Same here...

Bot was removed from Group and re-added. After that, i got these error when trying to send messages to the group.

sid-khullar commented 3 years ago

I ended up having to create a new bot for the purpose.

On Fri, 2 Apr, 2021, 3:17 pm Peter Mayer, @.***> wrote:

Hi. I'm not sure if this is the right place, but I'm at a loss for options. My bot receives the "bot was kicked from the supergroup chat" when it tries to send a message to a group it used to be a part of, was removed and then added again as an admin. Privacy mode is disabled.

Same here...

Bot was removed from Group and re-added. After that, i got these error when trying to send messages to the group.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TelegramBots/Telegram.Bot/issues/662#issuecomment-812458112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3GN3NLI3KHO3X7DL63F2TTGWHCZANCNFSM4EY2QYMA .