owpengram-server/internal/domain/botapi_chat.go
Astra 11dd7660c0 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.
2026-09-09 16:26:33 +01:00

32 lines
1.1 KiB
Go

package domain
// BotAPIChat is a peer resolved for the Bot API getChat method. The bot need
// not be a member: a public channel or supergroup resolves (projected as a
// preview), while a private chat the bot has no access to resolves to an error.
type BotAPIChat struct {
Peer Peer // domain peer; the Bot API chat-id encoding is applied by the projection
Type string // "private" | "group" | "supergroup" | "channel"
Title string
Username string
FirstName string
LastName string
Description string // channel/supergroup "about"
IsForum bool
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
}