botapi: getChatMemberCount, getChatMember, and a fuller getChat

- getChatMemberCount: channel/supergroup participant count (numeric chat_id).
- getChatMember: resolves a member via GetParticipant, projected to a Bot API
  ChatMember (creator/administrator/restricted/member/left/kicked with the
  matching rights); a user simply not in an accessible chat returns "left".
- getChat now uses the full channel view and adds permissions (from the default
  restrictions), slow_mode_delay, linked_chat_id and pinned_message.

Channel-only methods reject user chat_ids; private chats the bot cannot access
return CHAT_NOT_FOUND.
This commit is contained in:
Astra 2026-09-09 16:26:33 +01:00
parent 71da34607e
commit d9ee8cbee0
5 changed files with 336 additions and 15 deletions

View file

@ -15,4 +15,18 @@ type BotAPIChat struct {
Verified bool
Scam bool
Fake bool
// Channel/supergroup only, from the full view.
SlowModeDelay int
LinkedChatID int64 // domain channel id; the projection applies the Bot API encoding
Permissions *ChannelBannedRights // default restrictions; nil for a user chat
PinnedMessage *Message
PinnedMessageUsers []User
}
// BotAPIChatMember is a resolved chat member for the Bot API getChatMember
// method.
type BotAPIChatMember struct {
User User
Member ChannelMember
}