Proper way to ban users writing via channels #46

Closed
opened 2022-07-20 15:10:58 +00:00 by eugenweissbart · 2 comments
eugenweissbart commented 2022-07-20 15:10:58 +00:00 (Migrated from github.com)

As of now, when you try to ban a user who is writing to a group using his channel, instead of blocking the channel, an internal TG entity called Channel_Bot is banned.
A proper way to block the channel would be to issue a banChatSenderChat command. To distinguish that it is a channel writing to the chat, you might want to check that from has it's is_bot set to true (may also want to check if username is Channel_Bot but I guess it's not required) and a message has also sender_chat key with it's type set to "channel". The id of sender_chat is what to be the second argument to a command, first one being the chat's id.

As of now, when you try to ban a user who is writing to a group using his channel, instead of blocking the channel, an internal TG entity called `Channel_Bot` is banned. A proper way to block the channel would be to issue a [banChatSenderChat](https://core.telegram.org/bots/api#banchatsenderchat) command. To distinguish that it is a channel writing to the chat, you might want to check that `from` has it's `is_bot` set to true (may also want to check if username is `Channel_Bot` but I guess it's not required) and a message has also `sender_chat` key with it's `type` set to "channel". The `id` of `sender_chat` is what to be the second argument to a command, first one being the chat's id.
backmeupplz commented 2022-07-21 13:06:56 +00:00 (Migrated from github.com)

This is a valid concern, I'll be happy to review and merge a PR that fixes this :)

This is a valid concern, I'll be happy to review and merge a PR that fixes this :)
backmeupplz commented 2026-10-22 17:31:09 +00:00 (Migrated from github.com)

Thank you for taking the time to report this, and sorry it sat without an answer for so long. I'm cleaning up old issues and closing this one because it has been inactive for a long time. If it still affects you, please open a new issue with the current details and I'll take a look.

Thank you for taking the time to report this, and sorry it sat without an answer for so long. I'm cleaning up old issues and closing this one because it has been inactive for a long time. If it still affects you, please open a new issue with the current details and I'll take a look.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/banofbot#46
No description provided.