You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
heya, trying out the bot, after fiddling for some time to get it running in a docker container, everything seems to work at first glance;
however, when a test user joins and does not fill out the captcha, the console prints:
2024-08-23 11:26:02,447 - __main__ - INFO - [<MYGROUP>] Captcha reply timeout for user <USER>.
2024-08-23 11:26:02,449 - __main__ - INFO - [<MYGROUP>] <UID> join_retries: 1
2024-08-23 11:26:02,449 - __main__ - INFO - [<MYGROUP>] Captcha Fail - Kick - <USER> (<UID>)
2024-08-23 11:26:02,547 - tlgbotutils - ERROR - [<MYGROUP>] Method is available for supergroup and channel chats only
2024-08-23 11:26:02,548 - __main__ - INFO - [<MYGROUP>] Unable to kick
2024-08-23 11:26:02,591 - __main__ - INFO - [<MYGROUP>] Removing msgs from user <USER>...
2024-08-23 11:26:12,528 - tlgbotutils - ERROR - [<MYGROUP>] Message to delete not found
(i have replaced the actual values with for privacy reasons)
im not good with python, but as far as i can tell this comes from tlg_kick_user which in turn leads to unban_chat_member ... and now i'm lost. :)
my group is a "normal" group, not a supergroup.. is that the issue? is there no "normal" kick API, or why is unban_chat_member used in the first place? is there a way to make it work for my group?
thanks & kr
The text was updated successfully, but these errors were encountered:
im not good with python, but as far as i can tell this comes from tlg_kick_user which in turn leads to unban_chat_member ... and now i'm lost. :)
Yes, the problem is in the "unban_chat_member()" function, that sends a "unbanChatMember" Bot API Request to kick users, and seems this request is only valid for supergroups and channels...
my group is a "normal" group, not a supergroup.. is that the issue?
Indeed you are facing this issue cause your group is a regular group and not a supergroup (perhaps due it is a private group?). By default, new Telegram groups created are standard, but once it becomes public, or it reaches 200 members, or some settings in the group are changed, them are silently and automatically upgraded into a supergroup.
Note: a regular group has limited functionality and Bots in it work poorly or do not work at all.
is there no "normal" kick API, or why is unban_chat_member used in the first place? is there a way to make it work for my group?
Afraid there is no "kick" request in the Bot API... A couple of years ago, I was using the "ban" request + "unrestrict" request to achive a "kick" behaviour, however it was replaced with the "unbanChatMember" request cause it is more safe to have a kick behaviour just with a single request, and also avoiding some weird issues that could happen if network is not working properly and 1 of this 2 requests is missing.
One possible fix for this is to improve the "tlg_kick_user()" function to apply the approach of "ban + unrestrict requests" if the "unban_chat_member()" fails due "Method is available for supergroup and channel chats only".
However, I have not test this Bot in regular groups from few years ago, so even if we manage to make the kick feature to work, there is no guaranteed that all other features will work properly.
To solve your issue, perhaps you could try to convert that regular group into a supergroup.
For that, try the following:
Set the group as public.
[Optional] Set it back to private if you want to keep the group private.
With this setting change the group should become a supergroup and the Bot will work properly.
J-Rios
changed the title
kick leads to "Method is available for supergroup and channel chats only"
[Bug] kick leads to "Method is available for supergroup and channel chats only"
Aug 24, 2024
J-Rios
changed the title
[Bug] kick leads to "Method is available for supergroup and channel chats only"
[Bug] Kick through "unbanChatMember" not working for standard/regular groups
Aug 24, 2024
heya, trying out the bot, after fiddling for some time to get it running in a docker container, everything seems to work at first glance;
however, when a test user joins and does not fill out the captcha, the console prints:
(i have replaced the actual values with for privacy reasons)
im not good with python, but as far as i can tell this comes from tlg_kick_user which in turn leads to unban_chat_member ... and now i'm lost. :)
my group is a "normal" group, not a supergroup.. is that the issue? is there no "normal" kick API, or why is unban_chat_member used in the first place? is there a way to make it work for my group?
thanks & kr
The text was updated successfully, but these errors were encountered: