Adds the getChat method to the HTTP Bot API gateway. Numeric chat_id only (no
@username). Resolution goes through the shared peer resolvers:
- user: ByID; unknown -> CHAT_NOT_FOUND
- channel/supergroup: ResolveChannel, so a public one resolves even when the bot
is not a member (projected as a preview); a private one the bot cannot access
-> CHAT_NOT_FOUND, a banned bot likewise
The Chat projection returns id (bot-api encoded), type ("channel" for a
broadcast, "supergroup" for a megagroup, "private" for a user), title, username,
first/last name, description, is_forum, and the scam/fake/verified flags.
18 lines
644 B
Go
18 lines
644 B
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
|
|
}
|