Banning telegram channels from groups as a bot - Stack Overflow

admin2025-04-30  1

I have a bot that needs to warn and ban users in a group. But I cannot ban them if someone writes as a channel. I want to ban the channel, not the owner

message.from_user returns a fallback value, which points to @Channel_Bot for backwards compatibility. I kept identifying the wrong user Is there a correct way of identifying such users?

I have a bot that needs to warn and ban users in a group. But I cannot ban them if someone writes as a channel. I want to ban the channel, not the owner

message.from_user returns a fallback value, which points to @Channel_Bot for backwards compatibility. I kept identifying the wrong user Is there a correct way of identifying such users?

Share Improve this question asked Jan 5 at 1:01 Азиз ХакбердиевАзиз Хакбердиев 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Messages sent on behalf of a chat has the field sender_chat which contains the ID of the used chat of the sent message. See: https://core.telegram.org/bots/api#message.

转载请注明原文地址:http://anycun.com/QandA/1746021052a91451.html