From 1cbaa0fffcbd515b15f90b220b91028089ea5a2a Mon Sep 17 00:00:00 2001 From: Apolisk Date: Fri, 28 Jun 2024 10:52:06 +0300 Subject: [PATCH] chat: removed ChatFullInfo media: added LiveForever --- bot.go | 2 +- chat.go | 16 +--------------- media.go | 4 ++++ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/bot.go b/bot.go index 52cca228..3062705a 100644 --- a/bot.go +++ b/bot.go @@ -1051,7 +1051,7 @@ func (b *Bot) ChatByID(id int64) (*Chat, error) { } // ChatByUsername fetches chat info by its username. -func (b *Bot) ChatByUsername(name string) (*ChatFullInfo, error) { +func (b *Bot) ChatByUsername(name string) (*Chat, error) { params := map[string]string{ "chat_id": name, } diff --git a/chat.go b/chat.go index 88508c8f..1f6a0e38 100644 --- a/chat.go +++ b/chat.go @@ -45,20 +45,6 @@ type Chat struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Username string `json:"username"` -} - -type ChatFullInfo struct { - ID int64 `json:"id"` - - // See ChatType and consts. - Type ChatType `json:"type"` - - // Won't be there for ChatPrivate. - Title string `json:"title"` - - FirstName string `json:"first_name"` - LastName string `json:"last_name"` - Username string `json:"username"` // Returns only in getChat Bio string `json:"bio,omitempty"` @@ -346,7 +332,7 @@ func (r ChatJoinRequest) Time() time.Time { } // Time returns the moment of the emoji status expiration. -func (c *ChatFullInfo) Time() time.Time { +func (c *Chat) Time() time.Time { return time.Unix(c.EmojiExpirationUnixtime, 0) } diff --git a/media.go b/media.go index bdce5557..2af63deb 100644 --- a/media.go +++ b/media.go @@ -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.