botapi: implement getChat

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.
This commit is contained in:
Astra 2026-09-09 16:14:49 +01:00
parent 78267ee0d3
commit d022521d67
5 changed files with 221 additions and 0 deletions

View file

@ -0,0 +1,18 @@
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
}