Files
mautrix-telegram/pkg/gotd/tdapi/tl_emoji_reaction_gen.go
T
2025-06-27 20:03:37 -07:00

500 lines
13 KiB
Go

// Code generated by gotdgen, DO NOT EDIT.
package tdapi
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// EmojiReaction represents TL type `emojiReaction#60532c5f`.
type EmojiReaction struct {
// Text representation of the reaction
Emoji string
// Reaction title
Title string
// True, if the reaction can be added to new messages and enabled in chats
IsActive bool
// Static icon for the reaction
StaticIcon Sticker
// Appear animation for the reaction
AppearAnimation Sticker
// Select animation for the reaction
SelectAnimation Sticker
// Activate animation for the reaction
ActivateAnimation Sticker
// Effect animation for the reaction
EffectAnimation Sticker
// Around animation for the reaction; may be null
AroundAnimation Sticker
// Center animation for the reaction; may be null
CenterAnimation Sticker
}
// EmojiReactionTypeID is TL type id of EmojiReaction.
const EmojiReactionTypeID = 0x60532c5f
// Ensuring interfaces in compile-time for EmojiReaction.
var (
_ bin.Encoder = &EmojiReaction{}
_ bin.Decoder = &EmojiReaction{}
_ bin.BareEncoder = &EmojiReaction{}
_ bin.BareDecoder = &EmojiReaction{}
)
func (e *EmojiReaction) Zero() bool {
if e == nil {
return true
}
if !(e.Emoji == "") {
return false
}
if !(e.Title == "") {
return false
}
if !(e.IsActive == false) {
return false
}
if !(e.StaticIcon.Zero()) {
return false
}
if !(e.AppearAnimation.Zero()) {
return false
}
if !(e.SelectAnimation.Zero()) {
return false
}
if !(e.ActivateAnimation.Zero()) {
return false
}
if !(e.EffectAnimation.Zero()) {
return false
}
if !(e.AroundAnimation.Zero()) {
return false
}
if !(e.CenterAnimation.Zero()) {
return false
}
return true
}
// String implements fmt.Stringer.
func (e *EmojiReaction) String() string {
if e == nil {
return "EmojiReaction(nil)"
}
type Alias EmojiReaction
return fmt.Sprintf("EmojiReaction%+v", Alias(*e))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*EmojiReaction) TypeID() uint32 {
return EmojiReactionTypeID
}
// TypeName returns name of type in TL schema.
func (*EmojiReaction) TypeName() string {
return "emojiReaction"
}
// TypeInfo returns info about TL type.
func (e *EmojiReaction) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "emojiReaction",
ID: EmojiReactionTypeID,
}
if e == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Emoji",
SchemaName: "emoji",
},
{
Name: "Title",
SchemaName: "title",
},
{
Name: "IsActive",
SchemaName: "is_active",
},
{
Name: "StaticIcon",
SchemaName: "static_icon",
},
{
Name: "AppearAnimation",
SchemaName: "appear_animation",
},
{
Name: "SelectAnimation",
SchemaName: "select_animation",
},
{
Name: "ActivateAnimation",
SchemaName: "activate_animation",
},
{
Name: "EffectAnimation",
SchemaName: "effect_animation",
},
{
Name: "AroundAnimation",
SchemaName: "around_animation",
},
{
Name: "CenterAnimation",
SchemaName: "center_animation",
},
}
return typ
}
// Encode implements bin.Encoder.
func (e *EmojiReaction) Encode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode emojiReaction#60532c5f as nil")
}
b.PutID(EmojiReactionTypeID)
return e.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (e *EmojiReaction) EncodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode emojiReaction#60532c5f as nil")
}
b.PutString(e.Emoji)
b.PutString(e.Title)
b.PutBool(e.IsActive)
if err := e.StaticIcon.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field static_icon: %w", err)
}
if err := e.AppearAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field appear_animation: %w", err)
}
if err := e.SelectAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field select_animation: %w", err)
}
if err := e.ActivateAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field activate_animation: %w", err)
}
if err := e.EffectAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field effect_animation: %w", err)
}
if err := e.AroundAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field around_animation: %w", err)
}
if err := e.CenterAnimation.Encode(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field center_animation: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (e *EmojiReaction) Decode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode emojiReaction#60532c5f to nil")
}
if err := b.ConsumeID(EmojiReactionTypeID); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: %w", err)
}
return e.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (e *EmojiReaction) DecodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode emojiReaction#60532c5f to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field emoji: %w", err)
}
e.Emoji = value
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field title: %w", err)
}
e.Title = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field is_active: %w", err)
}
e.IsActive = value
}
{
if err := e.StaticIcon.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field static_icon: %w", err)
}
}
{
if err := e.AppearAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field appear_animation: %w", err)
}
}
{
if err := e.SelectAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field select_animation: %w", err)
}
}
{
if err := e.ActivateAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field activate_animation: %w", err)
}
}
{
if err := e.EffectAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field effect_animation: %w", err)
}
}
{
if err := e.AroundAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field around_animation: %w", err)
}
}
{
if err := e.CenterAnimation.Decode(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field center_animation: %w", err)
}
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (e *EmojiReaction) EncodeTDLibJSON(b tdjson.Encoder) error {
if e == nil {
return fmt.Errorf("can't encode emojiReaction#60532c5f as nil")
}
b.ObjStart()
b.PutID("emojiReaction")
b.Comma()
b.FieldStart("emoji")
b.PutString(e.Emoji)
b.Comma()
b.FieldStart("title")
b.PutString(e.Title)
b.Comma()
b.FieldStart("is_active")
b.PutBool(e.IsActive)
b.Comma()
b.FieldStart("static_icon")
if err := e.StaticIcon.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field static_icon: %w", err)
}
b.Comma()
b.FieldStart("appear_animation")
if err := e.AppearAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field appear_animation: %w", err)
}
b.Comma()
b.FieldStart("select_animation")
if err := e.SelectAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field select_animation: %w", err)
}
b.Comma()
b.FieldStart("activate_animation")
if err := e.ActivateAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field activate_animation: %w", err)
}
b.Comma()
b.FieldStart("effect_animation")
if err := e.EffectAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field effect_animation: %w", err)
}
b.Comma()
b.FieldStart("around_animation")
if err := e.AroundAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field around_animation: %w", err)
}
b.Comma()
b.FieldStart("center_animation")
if err := e.CenterAnimation.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode emojiReaction#60532c5f: field center_animation: %w", err)
}
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (e *EmojiReaction) DecodeTDLibJSON(b tdjson.Decoder) error {
if e == nil {
return fmt.Errorf("can't decode emojiReaction#60532c5f to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("emojiReaction"); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: %w", err)
}
case "emoji":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field emoji: %w", err)
}
e.Emoji = value
case "title":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field title: %w", err)
}
e.Title = value
case "is_active":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field is_active: %w", err)
}
e.IsActive = value
case "static_icon":
if err := e.StaticIcon.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field static_icon: %w", err)
}
case "appear_animation":
if err := e.AppearAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field appear_animation: %w", err)
}
case "select_animation":
if err := e.SelectAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field select_animation: %w", err)
}
case "activate_animation":
if err := e.ActivateAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field activate_animation: %w", err)
}
case "effect_animation":
if err := e.EffectAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field effect_animation: %w", err)
}
case "around_animation":
if err := e.AroundAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field around_animation: %w", err)
}
case "center_animation":
if err := e.CenterAnimation.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode emojiReaction#60532c5f: field center_animation: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// GetEmoji returns value of Emoji field.
func (e *EmojiReaction) GetEmoji() (value string) {
if e == nil {
return
}
return e.Emoji
}
// GetTitle returns value of Title field.
func (e *EmojiReaction) GetTitle() (value string) {
if e == nil {
return
}
return e.Title
}
// GetIsActive returns value of IsActive field.
func (e *EmojiReaction) GetIsActive() (value bool) {
if e == nil {
return
}
return e.IsActive
}
// GetStaticIcon returns value of StaticIcon field.
func (e *EmojiReaction) GetStaticIcon() (value Sticker) {
if e == nil {
return
}
return e.StaticIcon
}
// GetAppearAnimation returns value of AppearAnimation field.
func (e *EmojiReaction) GetAppearAnimation() (value Sticker) {
if e == nil {
return
}
return e.AppearAnimation
}
// GetSelectAnimation returns value of SelectAnimation field.
func (e *EmojiReaction) GetSelectAnimation() (value Sticker) {
if e == nil {
return
}
return e.SelectAnimation
}
// GetActivateAnimation returns value of ActivateAnimation field.
func (e *EmojiReaction) GetActivateAnimation() (value Sticker) {
if e == nil {
return
}
return e.ActivateAnimation
}
// GetEffectAnimation returns value of EffectAnimation field.
func (e *EmojiReaction) GetEffectAnimation() (value Sticker) {
if e == nil {
return
}
return e.EffectAnimation
}
// GetAroundAnimation returns value of AroundAnimation field.
func (e *EmojiReaction) GetAroundAnimation() (value Sticker) {
if e == nil {
return
}
return e.AroundAnimation
}
// GetCenterAnimation returns value of CenterAnimation field.
func (e *EmojiReaction) GetCenterAnimation() (value Sticker) {
if e == nil {
return
}
return e.CenterAnimation
}