Skip to content

Commit

Permalink
chat: removed ChatFullInfo media: added LiveForever
Browse files Browse the repository at this point in the history
  • Loading branch information
Apolisk committed Jun 28, 2024
1 parent 34ec635 commit 1cbaa0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
16 changes: 1 addition & 15 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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)
}

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

0 comments on commit 1cbaa0f

Please sign in to comment.