Phase 6: inline mode and docs
- Inline mode (INLINE_MODE_ENABLED): "@bot <link>" sends the cached file by file_id when the user's limits admit it without payment, and otherwise one result that opens the bot with /start il_<token> for the link. An inline send counts as a download when Telegram reports it chosen (inline feedback). The bot asks Telegram for inline_query and chosen_inline_result updates. - README, OPERATIONS and ARCHITECTURE describe the new flows, Stars, inline mode and every new setting; docs/SCREENS.md regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d64db03f21
commit
44d0905fa3
@@ -399,6 +399,33 @@ func (s *Server) pushPaymentLocked(userID int64, field string, body map[string]a
|
||||
}})
|
||||
}
|
||||
|
||||
// PushInlineQuery queues "@bot <query>" typed by a user, and returns the
|
||||
// query ID.
|
||||
func (s *Server) PushInlineQuery(userID int64, query string) string {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
id := fmt.Sprintf("iq%d", s.updateID+1)
|
||||
s.pushLocked(map[string]any{"inline_query": map[string]any{
|
||||
"id": id,
|
||||
"from": map[string]any{"id": userID, "is_bot": false, "first_name": "User", "language_code": s.userLang(userID)},
|
||||
"query": query,
|
||||
"offset": "",
|
||||
}})
|
||||
return id
|
||||
}
|
||||
|
||||
// PushChosenInlineResult queues the report that a user sent an inline
|
||||
// result (inline feedback).
|
||||
func (s *Server) PushChosenInlineResult(userID int64, resultID, query string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.pushLocked(map[string]any{"chosen_inline_result": map[string]any{
|
||||
"result_id": resultID,
|
||||
"from": map[string]any{"id": userID, "is_bot": false, "first_name": "User", "language_code": s.userLang(userID)},
|
||||
"query": query,
|
||||
}})
|
||||
}
|
||||
|
||||
// PushRaw queues an arbitrary update body, for example my_chat_member.
|
||||
func (s *Server) PushRaw(update map[string]any) {
|
||||
s.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user