Closed rufatagayev closed 8 months ago
In channels only their administrators can ever write messages. Broadcast groups aren't channels. They are special types of supergroups, which can have more than 200000 members, but can't change chatPermissions
to allow ordinary members to write messages. If chat permissions can be changed in the group, then it isn't a broadcast group. You need to checK chat permissions to see what types of messages non-administrator users can send to the chat currently.
I also check for chat.permissions.canSendBasicMessages
, but some groups still come through where users can send basic text messages. How do I get only those chats where there is no input field at the bottom in telegram for normal users?
It is up to specific app when it shows or not the input field.
So as I understand only (chat.type as TdApi.ChatTypeSupergroup).isChannel
should be the right way to check if only admins can post? If so, why do I still get some channels where users can freely send text messages? This is how I check for channels:
return this.type is TdApi.ChatTypeSupergroup &&
(this.type as TdApi.ChatTypeSupergroup).isChannel &&
this.permissions.canSendBasicMessages.not()
No. Channels and supergroups are very different and have a lot of other differencies. Ordinary users can never post to channels or broadcast groups, but the ability to send messages can be also disabled in regular supergroups via chat permissions.
Ok, I'll try to clarify what I mean: I filter for channels using .isChannel
. But I also get one or two groups such as t.me/tdlibchat. In Telegram app, t.me/tdlibchat appears under groups.
tdlibchat
isn't a channel. It is a regular supergroup.
Exactly. It is a regular supergroup, but its messages show up in my results even when I filter chats for (this.type as TdApi.ChatTypeSupergroup).isChannel
. I can't understand why. By the way, this happens when I first open the app. If I close and reopen, these messages do not show up. It seems to be something related to offline / cache. But I can't figure it out.
This isn't possible. For the tdlibchat
type.isChannel is always false.
You can enable TDLib logs with verbosity level 5 and check there that isChannel == false
. You can also share the log with https://t.me/tdlib_bot.
These non-channel messages have stopped appearing now. I also added a check for each TdApi.Message to see if message.isChannelPost is true and I think it worked. Closing the issue. Thank you for help!
I'm using the java library in my android app. The
TdApi.Supergroup
object has aisBroadcastGroup
property, indicating that the group is a broadcast group, i.e. only admins can post messages. As I understand, these are groups in the telegram app where you don't have an input field at the bottom to send a message. I have a bunch of such channels which I'm subscribed to. But when I get these channels in my android app and check theisBroadcastGroup
property for these channels, they always returnfalse
. Why is that? I already check theTdApi.Chat.isChannel
property separately, and that returns true for channels, but I want only those channels where only admins can post, not users.