commit
68663614af
24
configs.go
24
configs.go
|
@ -2064,6 +2064,24 @@ func (config GetStickerSetConfig) params() (Params, error) {
|
||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCustomEmojiStickersConfig get information about
|
||||||
|
// custom emoji stickers by their identifiers.
|
||||||
|
type GetCustomEmojiStickersConfig struct {
|
||||||
|
CustomEmojiIDs []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (config GetCustomEmojiStickersConfig) params() (Params, error) {
|
||||||
|
params := make(Params)
|
||||||
|
|
||||||
|
params.AddInterface("custom_emoji_ids", config.CustomEmojiIDs)
|
||||||
|
|
||||||
|
return params, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (config GetCustomEmojiStickersConfig) method() string {
|
||||||
|
return "getCustomEmojiStickers"
|
||||||
|
}
|
||||||
|
|
||||||
// UploadStickerConfig allows you to upload a sticker for use in a set later.
|
// UploadStickerConfig allows you to upload a sticker for use in a set later.
|
||||||
type UploadStickerConfig struct {
|
type UploadStickerConfig struct {
|
||||||
UserID int64
|
UserID int64
|
||||||
|
@ -2098,8 +2116,9 @@ type NewStickerSetConfig struct {
|
||||||
Title string
|
Title string
|
||||||
PNGSticker RequestFileData
|
PNGSticker RequestFileData
|
||||||
TGSSticker RequestFileData
|
TGSSticker RequestFileData
|
||||||
|
StickerType string
|
||||||
Emojis string
|
Emojis string
|
||||||
ContainsMasks bool
|
ContainsMasks bool // deprecated
|
||||||
MaskPosition *MaskPosition
|
MaskPosition *MaskPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2113,11 +2132,10 @@ func (config NewStickerSetConfig) params() (Params, error) {
|
||||||
params.AddNonZero64("user_id", config.UserID)
|
params.AddNonZero64("user_id", config.UserID)
|
||||||
params["name"] = config.Name
|
params["name"] = config.Name
|
||||||
params["title"] = config.Title
|
params["title"] = config.Title
|
||||||
|
|
||||||
params["emojis"] = config.Emojis
|
params["emojis"] = config.Emojis
|
||||||
|
|
||||||
params.AddBool("contains_masks", config.ContainsMasks)
|
params.AddBool("contains_masks", config.ContainsMasks)
|
||||||
|
params.AddNonEmpty("sticker_type", string(config.StickerType))
|
||||||
err := params.AddInterface("mask_position", config.MaskPosition)
|
err := params.AddInterface("mask_position", config.MaskPosition)
|
||||||
|
|
||||||
return params, err
|
return params, err
|
||||||
|
|
54
types.go
54
types.go
|
@ -278,6 +278,12 @@ type Chat struct {
|
||||||
//
|
//
|
||||||
// optional
|
// optional
|
||||||
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
|
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
|
||||||
|
// HasRestrictedVoiceAndVideoMessages if the privacy settings of the other party
|
||||||
|
// restrict sending voice and video note messages
|
||||||
|
// in the private chat. Returned only in getChat.
|
||||||
|
//
|
||||||
|
// optional
|
||||||
|
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
|
||||||
// JoinToSendMessages is true, if users need to join the supergroup
|
// JoinToSendMessages is true, if users need to join the supergroup
|
||||||
// before they can send messages.
|
// before they can send messages.
|
||||||
// Returned only in getChat
|
// Returned only in getChat
|
||||||
|
@ -746,6 +752,7 @@ type MessageEntity struct {
|
||||||
// “pre” (monowidth block),
|
// “pre” (monowidth block),
|
||||||
// “text_link” (for clickable text URLs),
|
// “text_link” (for clickable text URLs),
|
||||||
// “text_mention” (for users without usernames)
|
// “text_mention” (for users without usernames)
|
||||||
|
// “text_mention” (for inline custom emoji stickers)
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
// Offset in UTF-16 code units to the start of the entity
|
// Offset in UTF-16 code units to the start of the entity
|
||||||
Offset int `json:"offset"`
|
Offset int `json:"offset"`
|
||||||
|
@ -763,6 +770,10 @@ type MessageEntity struct {
|
||||||
//
|
//
|
||||||
// optional
|
// optional
|
||||||
Language string `json:"language,omitempty"`
|
Language string `json:"language,omitempty"`
|
||||||
|
// CustomEmojiID for “custom_emoji” only, unique identifier of the custom emoji
|
||||||
|
//
|
||||||
|
// optional
|
||||||
|
CustomEmojiID string `json:"custom_emoji_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseURL attempts to parse a URL contained within a MessageEntity.
|
// ParseURL attempts to parse a URL contained within a MessageEntity.
|
||||||
|
@ -2000,6 +2011,13 @@ type InputMediaDocument struct {
|
||||||
DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
|
DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Constant values for sticker types
|
||||||
|
const (
|
||||||
|
StickerTypeRegular = "regular"
|
||||||
|
StickerTypeMask = "mask"
|
||||||
|
StickerTypeCustomEmoji = "custom_emoji"
|
||||||
|
)
|
||||||
|
|
||||||
// Sticker represents a sticker.
|
// Sticker represents a sticker.
|
||||||
type Sticker struct {
|
type Sticker struct {
|
||||||
// FileID is an identifier for this file, which can be used to download or
|
// FileID is an identifier for this file, which can be used to download or
|
||||||
|
@ -2009,6 +2027,10 @@ type Sticker struct {
|
||||||
// which is supposed to be the same over time and for different bots.
|
// which is supposed to be the same over time and for different bots.
|
||||||
// Can't be used to download or reuse the file.
|
// Can't be used to download or reuse the file.
|
||||||
FileUniqueID string `json:"file_unique_id"`
|
FileUniqueID string `json:"file_unique_id"`
|
||||||
|
// Type is a type of the sticker, currently one of “regular”,
|
||||||
|
// “mask”, “custom_emoji”. The type of the sticker is independent
|
||||||
|
// from its format, which is determined by the fields is_animated and is_video.
|
||||||
|
Type string `json:"type"`
|
||||||
// Width sticker width
|
// Width sticker width
|
||||||
Width int `json:"width"`
|
Width int `json:"width"`
|
||||||
// Height sticker height
|
// Height sticker height
|
||||||
|
@ -2052,6 +2074,21 @@ type Sticker struct {
|
||||||
FileSize int `json:"file_size,omitempty"`
|
FileSize int `json:"file_size,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsRegular returns if the Sticker is regular
|
||||||
|
func (s Sticker) IsRegular() bool {
|
||||||
|
return s.Type == StickerTypeRegular
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsMask returns if the Sticker is mask
|
||||||
|
func (s Sticker) IsMask() bool {
|
||||||
|
return s.Type == StickerTypeMask
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCustomEmoji returns if the Sticker is custom emoji
|
||||||
|
func (s Sticker) IsCustomEmoji() bool {
|
||||||
|
return s.Type == StickerTypeCustomEmoji
|
||||||
|
}
|
||||||
|
|
||||||
// StickerSet represents a sticker set.
|
// StickerSet represents a sticker set.
|
||||||
type StickerSet struct {
|
type StickerSet struct {
|
||||||
// Name sticker set name
|
// Name sticker set name
|
||||||
|
@ -2065,6 +2102,8 @@ type StickerSet struct {
|
||||||
// IsVideo true, if the sticker set contains video stickers
|
// IsVideo true, if the sticker set contains video stickers
|
||||||
IsVideo bool `json:"is_video"`
|
IsVideo bool `json:"is_video"`
|
||||||
// ContainsMasks true, if the sticker set contains masks
|
// ContainsMasks true, if the sticker set contains masks
|
||||||
|
//
|
||||||
|
// deprecated. Use sticker_type instead
|
||||||
ContainsMasks bool `json:"contains_masks"`
|
ContainsMasks bool `json:"contains_masks"`
|
||||||
// Stickers list of all set stickers
|
// Stickers list of all set stickers
|
||||||
Stickers []Sticker `json:"stickers"`
|
Stickers []Sticker `json:"stickers"`
|
||||||
|
@ -2072,6 +2111,21 @@ type StickerSet struct {
|
||||||
Thumbnail *PhotoSize `json:"thumb"`
|
Thumbnail *PhotoSize `json:"thumb"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsRegular returns if the StickerSet is regular
|
||||||
|
func (s StickerSet) IsRegular() bool {
|
||||||
|
return s.StickerType == StickerTypeRegular
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsMask returns if the StickerSet is mask
|
||||||
|
func (s StickerSet) IsMask() bool {
|
||||||
|
return s.StickerType == StickerTypeMask
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCustomEmoji returns if the StickerSet is custom emoji
|
||||||
|
func (s StickerSet) IsCustomEmoji() bool {
|
||||||
|
return s.StickerType == StickerTypeCustomEmoji
|
||||||
|
}
|
||||||
|
|
||||||
// MaskPosition describes the position on faces where a mask should be placed
|
// MaskPosition describes the position on faces where a mask should be placed
|
||||||
// by default.
|
// by default.
|
||||||
type MaskPosition struct {
|
type MaskPosition struct {
|
||||||
|
|
Loading…
Reference in New Issue