// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// 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{}
)

// MessagesGetAttachMenuBotRequest represents TL type `messages.getAttachMenuBot#77216192`.
// Returns attachment menu entry for a bot mini app that can be launched from the
// attachment menu »¹
//
// Links:
//  1. https://core.telegram.org/api/bots/attach
//
// See https://core.telegram.org/method/messages.getAttachMenuBot for reference.
type MessagesGetAttachMenuBotRequest struct {
	// Bot ID
	Bot InputUserClass
}

// MessagesGetAttachMenuBotRequestTypeID is TL type id of MessagesGetAttachMenuBotRequest.
const MessagesGetAttachMenuBotRequestTypeID = 0x77216192

// Ensuring interfaces in compile-time for MessagesGetAttachMenuBotRequest.
var (
	_ bin.Encoder     = &MessagesGetAttachMenuBotRequest{}
	_ bin.Decoder     = &MessagesGetAttachMenuBotRequest{}
	_ bin.BareEncoder = &MessagesGetAttachMenuBotRequest{}
	_ bin.BareDecoder = &MessagesGetAttachMenuBotRequest{}
)

func ( *MessagesGetAttachMenuBotRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Bot == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *MessagesGetAttachMenuBotRequest) () string {
	if  == nil {
		return "MessagesGetAttachMenuBotRequest(nil)"
	}
	type  MessagesGetAttachMenuBotRequest
	return fmt.Sprintf("MessagesGetAttachMenuBotRequest%+v", (*))
}

// FillFrom fills MessagesGetAttachMenuBotRequest from given interface.
func ( *MessagesGetAttachMenuBotRequest) ( interface {
	() ( InputUserClass)
}) {
	.Bot = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*MessagesGetAttachMenuBotRequest) () uint32 {
	return MessagesGetAttachMenuBotRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*MessagesGetAttachMenuBotRequest) () string {
	return "messages.getAttachMenuBot"
}

// TypeInfo returns info about TL type.
func ( *MessagesGetAttachMenuBotRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getAttachMenuBot",
		ID:   MessagesGetAttachMenuBotRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetAttachMenuBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getAttachMenuBot#77216192 as nil")
	}
	.PutID(MessagesGetAttachMenuBotRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetAttachMenuBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getAttachMenuBot#77216192 as nil")
	}
	if .Bot == nil {
		return fmt.Errorf("unable to encode messages.getAttachMenuBot#77216192: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getAttachMenuBot#77216192: field bot: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetAttachMenuBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getAttachMenuBot#77216192 to nil")
	}
	if  := .ConsumeID(MessagesGetAttachMenuBotRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getAttachMenuBot#77216192: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetAttachMenuBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getAttachMenuBot#77216192 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getAttachMenuBot#77216192: field bot: %w", )
		}
		.Bot = 
	}
	return nil
}

// GetBot returns value of Bot field.
func ( *MessagesGetAttachMenuBotRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .Bot
}

// MessagesGetAttachMenuBot invokes method messages.getAttachMenuBot#77216192 returning error if any.
// Returns attachment menu entry for a bot mini app that can be launched from the
// attachment menu »¹
//
// Links:
//  1. https://core.telegram.org/api/bots/attach
//
// Possible errors:
//
//	400 BOT_INVALID: This is not a valid bot.
//
// See https://core.telegram.org/method/messages.getAttachMenuBot for reference.
func ( *Client) ( context.Context,  InputUserClass) (*AttachMenuBotsBot, error) {
	var  AttachMenuBotsBot

	 := &MessagesGetAttachMenuBotRequest{
		Bot: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}