Skip to content

Commit

Permalink
v6.2 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
negasus authored Aug 23, 2022
1 parent 11caaea commit 0dca12b
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.2.2 (2022-08-23)

- support bot api v6.2

## v0.2.1 (2022-07-08)

- support bot api v6.1
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Golang Telegram Bot

> The project is under development. API may be changed before v1.0.0 version.
> [Telegram Group](https://t.me/gotelegrambotui)
> Supports Bot API version: [6.1](https://core.telegram.org/bots/api#june-20-2022) from June 20, 2022
> Supports Bot API version: [6.2](https://core.telegram.org/bots/api#august-12-2022) from August 12, 2022
It's a Go zero-dependencies telegram bot framework

Expand Down
7 changes: 7 additions & 0 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,13 @@ func (b *Bot) GetStickerSet(ctx context.Context, params *GetStickerSetParams) (*
return result, err
}

// GetCustomEmojiStickers https://core.telegram.org/bots/api#getcustomemojistickers
func (b *Bot) GetCustomEmojiStickers(ctx context.Context, params *GetCustomEmojiStickersParams) ([]*models.Sticker, error) {
var result []*models.Sticker
err := b.rawRequest(ctx, "getCustomEmojiStickers", params, &result)
return result, err
}

// UploadStickerFile https://core.telegram.org/bots/api#uploadstickerfile
func (b *Bot) UploadStickerFile(ctx context.Context, params *UploadStickerFileParams) (*models.File, error) {
result := &models.File{}
Expand Down
5 changes: 5 additions & 0 deletions methods_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ type GetStickerSetParams struct {
Name string `json:"name"`
}

type GetCustomEmojiStickersParams struct {
CustomEmojiIDs []string `json:"custom_emoji_ids"`
}

type UploadStickerFileParams struct {
UserID int `json:"user_id"`
PngSticker models.InputFile `json:"png_sticker"`
Expand All @@ -552,6 +556,7 @@ type CreateNewStickerSetParams struct {
PngSticker models.InputFile `json:"png_sticker,omitempty"`
TgsSticker models.InputFile `json:"tgs_sticker,omitempty"`
WebmSticker models.InputFile `json:"webm_sticker,omitempty"`
StickerType string `json:"sticker_type,omitempty"`
Emojis string `json:"emojis"`
ContainsMasks bool `json:"contains_masks,omitempty"`
MaskPosition models.MaskPosition `json:"mask_position,omitempty"`
Expand Down
45 changes: 23 additions & 22 deletions models/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,27 @@ type ChatLocation struct {

// Chat https://core.telegram.org/bots/api#chat
type Chat struct {
ID int `json:"id"`
Type string `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
Bio string `json:"bio"`
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
JoinToSendMessages bool `json:"join_to_send_messages"`
JoinByRequest bool `json:"join_by_request"`
Description string `json:"description,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
LinkedChatID int `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
ID int `json:"id"`
Type string `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
Bio string `json:"bio"`
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
JoinToSendMessages bool `json:"join_to_send_messages"`
JoinByRequest bool `json:"join_by_request"`
Description string `json:"description,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
LinkedChatID int `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
}
14 changes: 8 additions & 6 deletions models/message_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ const (
MessageEntityTypePre MessageEntityType = "pre"
MessageEntityTypeTextLink MessageEntityType = "text_link"
MessageEntityTypeTextMention MessageEntityType = "text_mention"
MessageEntityTypeCustomEmoji MessageEntityType = "custom_emoji"
)

// MessageEntity https://core.telegram.org/bots/api#messageentity
type MessageEntity struct {
Type MessageEntityType `json:"type"`
Offset int `json:"offset"`
Length int `json:"length"`
URL string `json:"url,omitempty"`
User *User `json:"user,omitempty"`
Language string `json:"language,omitempty"`
Type MessageEntityType `json:"type"`
Offset int `json:"offset"`
Length int `json:"length"`
URL string `json:"url,omitempty"`
User *User `json:"user,omitempty"`
Language string `json:"language,omitempty"`
CustomEmojiID string `json:"custom_emoji_id"`
}
2 changes: 2 additions & 0 deletions models/sticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type MaskPosition struct {
type Sticker struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Type string `json:"type"`
Width int `json:"width"`
Height int `json:"height"`
IsAnimated bool `json:"is_animated"`
Expand All @@ -21,5 +22,6 @@ type Sticker struct {
SetName string `json:"set_name,omitempty"`
PremiumAnimation *File `json:"premium_animation,omitempty"`
MaskPosition MaskPosition `json:"mask_position,omitempty"`
CustomEmojiID string `json:"custom_emoji_id"`
FileSize int `json:"file_size,omitempty"`
}
1 change: 1 addition & 0 deletions models/sticker_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package models
type StickerSet struct {
Name string `json:"name"`
Title string `json:"title"`
StickerType string `json:"sticker_type"`
IsAnimated bool `json:"is_animated"`
IsVideo bool `json:"is_video"`
ContainsMasks bool `json:"contains_masks"`
Expand Down

0 comments on commit 0dca12b

Please sign in to comment.