Skip to content

Commit

Permalink
implement bot api 7.3 (#699)
Browse files Browse the repository at this point in the history
* BotAPI7.3

* implement class ChatFullInfo

* chat: removed ChatFullInfo media: added LiveForever

---------

Co-authored-by: demget <[email protected]>
  • Loading branch information
Apolisk and demget authored Aug 9, 2024
1 parent b85939e commit 5218831
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 6 deletions.
60 changes: 60 additions & 0 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type Chat struct {
ProfileBackgroundEmojiID string `json:"profile_background_custom_emoji_id"`
HasVisibleHistory bool `json:"has_visible_history"`
UnrestrictBoosts int `json:"unrestrict_boost_count"`
MaxReactionCount int `json:"max_reaction_count"`
Birthdate Birthdate `json:"birthdate,omitempty"`
PersonalChat *Chat `json:"personal_chat,omitempty"`
BusinessIntro BusinessIntro `json:"business_intro,omitempty"`
Expand Down Expand Up @@ -171,6 +172,11 @@ type ChatMemberUpdate struct {
// join the chat; for joining by invite link events only.
InviteLink *ChatInviteLink `json:"invite_link"`

// (Optional) True, if the user joined the chat after sending
//a direct join request without using an invite link and being
//approved by an administrator
ViaJoinRequest bool `json:"via_join_request"`

// (Optional) True, if the user joined the chat via a chat folder invite link.
ViaFolderLink bool `json:"via_chat_folder_invite_link"`
}
Expand Down Expand Up @@ -267,6 +273,60 @@ type Story struct {
Poster *Chat `json:"chat"`
}

type BackgroundFill struct {
// Type of the background fill, always “solid”
Type string `json:"type"`

// The color of the background fill in the RGB24 format
Color int `json:"color,omitempty"`

// Top color of the gradient in the RGB24 format
TopColor int `json:"top_color,omitempty"`

// Bottom color of the gradient in the RGB24 format
BottomColor int `json:"bottom_color,omitempty"`

// Clockwise rotation angle of the background fill in degrees; 0-359
RotationAngle int `json:"rotation_angle,omitempty"`

// A list of the 3 or 4 base colors that are used to generate
// the freeform gradient in the RGB24 format
Colors []int `json:"colors,omitempty"`
}

type BackgroundType struct {
// Type of the background, always “fill”
Type string `json:"type"`

// The background fill
Fill BackgroundFill `json:"fill,omitempty"`

// Document with the wallpaper
Document Document `json:"document,omitempty"`

// Dimming of the background in dark themes, as a percentage; 0-100
DarkThemeDimming int `json:"dark_theme_dimming,omitempty"`

// Intensity of the pattern when it is shown above the filled background; 0-100
Intensity int `json:"intensity,omitempty"`

// (Optional) True, if the wallpaper is downscaled to fit in a 450x450
// square and then box-blurred with radius 12
IsBlurred bool `json:"is_blurred,omitempty"`

// (Optional) True, if the background moves slightly when the device is tilted
IsMoving bool `json:"is_moving,omitempty"`

// (Optional) True, if the background fill must be applied only to the pattern itself.
// All other pixels are black in this case. For dark themes only
IsInverted bool `json:"is_inverted,omitempty"`
}

type ChatBackground struct {
// Type of the background
Type BackgroundType `json:"type"`
}

type Birthdate struct {
// Day of the user's birth; 1-31
Day int `json:"day"`
Expand Down
4 changes: 4 additions & 0 deletions media.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package telebot

import (
"encoding/json"
"math"
)

// Alias for math.MaxInt32
const LiveForever = math.MaxInt32

// Media is a generic type for all kinds of media that includes File.
type Media interface {
// MediaType returns string-represented media type.
Expand Down
3 changes: 3 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ type Message struct {
// Service message: user boosted the chat.
BoostAdded *BoostAdded `json:"boost_added"`

// Service message: chat background set
ChatBackgroundSet ChatBackground `json:"chat_background_set"`

// If the sender of the message boosted the chat, the number of boosts
// added by the user.
SenderBoostCount int `json:"sender_boost_count"`
Expand Down
18 changes: 12 additions & 6 deletions poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ type Poll struct {
VoterCount int `json:"total_voter_count"`

// (Optional)
Closed bool `json:"is_closed,omitempty"`
CorrectOption int `json:"correct_option_id,omitempty"`
MultipleAnswers bool `json:"allows_multiple_answers,omitempty"`
Explanation string `json:"explanation,omitempty"`
ParseMode ParseMode `json:"explanation_parse_mode,omitempty"`
Entities []MessageEntity `json:"explanation_entities"`
Closed bool `json:"is_closed,omitempty"`
CorrectOption int `json:"correct_option_id,omitempty"`
MultipleAnswers bool `json:"allows_multiple_answers,omitempty"`
Explanation string `json:"explanation,omitempty"`
ParseMode ParseMode `json:"explanation_parse_mode,omitempty"`
Entities []MessageEntity `json:"explanation_entities"`
QuestionEntities []MessageEntity `json:"question_entities"`
QuestionParseMode string `json:"question_parse_mode"`

// True by default, shouldn't be omitted.
Anonymous bool `json:"is_anonymous"`
Expand All @@ -43,6 +45,10 @@ type Poll struct {
type PollOption struct {
Text string `json:"text"`
VoterCount int `json:"voter_count"`

// (Optional) A JSON-serialized list of special entities that appear
//in the poll option text. It can be specified instead of text_parse_mode
TextEntities []MessageEntity `json:"text_entities"`
}

// PollAnswer represents an answer of a user in a non-anonymous poll.
Expand Down

0 comments on commit 5218831

Please sign in to comment.