TelegramPHP Documentation

Sticker extends Part
in package

This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.

Do not edit it by hand - run composer spec:build instead.

This object represents a sticker.

Tags
link
https://core.telegram.org/bots/api#sticker
since

v10.3

Table of Contents

Constants

DISCRIMINATOR  : mixed = null
The attribute whose value names the concrete subtype, for union parents.
SUBTYPES  : array<string, Part>>|array<int, Part>> = []
The concrete classes a union parent may resolve to - keyed by discriminator value when there is one, a plain list otherwise. Empty on ordinary parts.

Properties

$custom_emoji_id  : string|null
$emoji  : string|null
$file_id  : string
$file_size  : int|null
$file_unique_id  : string
$height  : int
$is_animated  : bool
$is_video  : bool
$mask_position  : MaskPosition|null
$needs_repainting  : bool|null
$premium_animation  : File|null
$set_name  : string|null
$thumbnail  : PhotoSize|null
$type  : string
$width  : int
$casts  : array<string, string>
Attribute name => Telegram type token ("User", "Array of PhotoSize"), used to hydrate nested objects into parts.
$dates  : array<int, string>
Attribute names holding Unix timestamps, read back as {@see CarbonImmutable}.
$fillable  : array<int, string>
Attribute names this part accepts. Empty = accept anything.
$telegram  : Telegram

Methods

__construct()  : mixed
__debugInfo()  : array<string, mixed>
__get()  : mixed
__isset()  : bool
__set()  : void
__toString()  : string
attributeExists()  : bool
fill()  : void
getAttribute()  : mixed
getCasts()  : array<string, string>
getFillable()  : array<int, string>
getRawAttributes()  : array<string, mixed>
getTelegram()  : Telegram
jsonSerialize()  : array<string, mixed>
The payload this part would be sent back to Telegram as - nested parts and collections flattened, timestamps left as the integers they arrived as.
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
resolveSubtype()  : Part>
The concrete class an incoming payload belongs to, for a union parent.
setAttribute()  : void
factory()  : Factory
Builds another part from the same client - for nested objects.
getRawAttribute()  : mixed
Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
setRawAttribute()  : void
Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.

Constants

DISCRIMINATOR

The attribute whose value names the concrete subtype, for union parents.

public mixed DISCRIMINATOR = null

null on ordinary parts and on unions Telegram does not tag.

SUBTYPES

The concrete classes a union parent may resolve to - keyed by discriminator value when there is one, a plain list otherwise. Empty on ordinary parts.

public array<string, Part>>|array<int, Part>> SUBTYPES = []

Properties

$custom_emoji_id

public string|null $custom_emoji_id

Optional. For custom emoji stickers, unique identifier of the custom emoji

$emoji

public string|null $emoji

Optional. Emoji associated with the sticker

$file_id

public string $file_id

Identifier for this file, which can be used to download or reuse the file

$file_size

public int|null $file_size

Optional. File size in bytes

$file_unique_id

public string $file_unique_id

Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.

$height

public int $height

Sticker height

$is_animated

public bool $is_animated

True, if the sticker is animated

$is_video

public bool $is_video

True, if the sticker is a video sticker

$mask_position

public MaskPosition|null $mask_position

Optional. For mask stickers, the position where the mask should be placed

$needs_repainting

public bool|null $needs_repainting

Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places

$premium_animation

public File|null $premium_animation

Optional. For premium regular stickers, premium animation for the sticker

$set_name

public string|null $set_name

Optional. Name of the sticker set to which the sticker belongs

$thumbnail

public PhotoSize|null $thumbnail

Optional. Sticker thumbnail in the .WEBP or .JPG format

$type

public string $type

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.

$width

public int $width

Sticker width

$casts

Attribute name => Telegram type token ("User", "Array of PhotoSize"), used to hydrate nested objects into parts.

protected array<string, string> $casts = ['thumbnail' => 'PhotoSize', 'premium_animation' => 'File', 'mask_position' => 'MaskPosition']

$dates

Attribute names holding Unix timestamps, read back as {@see CarbonImmutable}.

protected array<int, string> $dates = []

$fillable

Attribute names this part accepts. Empty = accept anything.

protected array<int, string> $fillable = ['file_id', 'file_unique_id', 'type', 'width', 'height', 'is_animated', 'is_video', 'thumbnail', 'emoji', 'set_name', 'premium_animation', 'mask_position', 'custom_emoji_id', 'needs_repainting', 'file_size']

Methods

__construct()

public __construct(Telegram $telegram[, array<string, mixed>|object $attributes = [] ]) : mixed
Parameters
$telegram : Telegram
$attributes : array<string, mixed>|object = []

__debugInfo()

public __debugInfo() : array<string, mixed>
Return values
array<string, mixed>

__get()

public __get(string $name) : mixed
Parameters
$name : string

__isset()

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool

__set()

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

__toString()

public __toString() : string
Return values
string

attributeExists()

public attributeExists(string $key) : bool
Parameters
$key : string
Return values
bool

fill()

public fill(array<string, mixed> $attributes) : void
Parameters
$attributes : array<string, mixed>

getAttribute()

public getAttribute(string $key) : mixed
Parameters
$key : string

getCasts()

public getCasts() : array<string, string>
Return values
array<string, string>

getFillable()

public getFillable() : array<int, string>
Return values
array<int, string>

getRawAttributes()

public getRawAttributes() : array<string, mixed>
Return values
array<string, mixed>

jsonSerialize()

The payload this part would be sent back to Telegram as - nested parts and collections flattened, timestamps left as the integers they arrived as.

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

resolveSubtype()

The concrete class an incoming payload belongs to, for a union parent.

public static resolveSubtype(array<string, mixed> $attributes) : Part>

Tagged unions resolve on their discriminator. The handful Telegram leaves untagged (InputMessageContent, and the rest), and any payload whose tag this build does not recognise - a member added to the Bot API since it was generated - resolve instead to the subtype whose attributes the payload matches most closely.

Parameters
$attributes : array<string, mixed>
Tags
throws
PartException

When the part is not a union, or nothing matches.

Return values
Part>

setAttribute()

public setAttribute(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

factory()

Builds another part from the same client - for nested objects.

protected factory() : Factory
Return values
Factory

getRawAttribute()

Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.

protected getRawAttribute(string $key) : mixed
Parameters
$key : string

setRawAttribute()

Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.

protected setRawAttribute(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
On this page

Search results