// Code generated by gotdgen, DO NOT EDIT.package tgimport ()// 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{})// BotsCreateBotRequest represents TL type `bots.createBot#e5b17f2b`.// Create a managed bot »¹ owned by the current user and controlled by the specified// manager bot.//// Links:// 1. https://core.telegram.org/api/bots/managed-bots#creating-a-managed-bot//// See https://core.telegram.org/method/bots.createBot for reference.typeBotsCreateBotRequeststruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Set only if the creation prompt was opened from a managed bot creation request deep // link »¹ // // Links: // 1) https://core.telegram.org/api/links#managed-bot-creation-request-linksViaDeeplinkbool// Display name of the bot, 1–64 charactersNamestring// Username for the bot, as validated by bots.checkUsername¹ // // Links: // 1) https://core.telegram.org/method/bots.checkUsernameUsernamestring// The manager bot that will control the created bot; must have the user¹ // bot_can_manage_bots flag set // // Links: // 1) https://core.telegram.org/constructor/userManagerIDInputUserClass}// BotsCreateBotRequestTypeID is TL type id of BotsCreateBotRequest.constBotsCreateBotRequestTypeID = 0xe5b17f2b// Ensuring interfaces in compile-time for BotsCreateBotRequest.var ( _ bin.Encoder = &BotsCreateBotRequest{} _ bin.Decoder = &BotsCreateBotRequest{} _ bin.BareEncoder = &BotsCreateBotRequest{} _ bin.BareDecoder = &BotsCreateBotRequest{})func ( *BotsCreateBotRequest) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.ViaDeeplink == false) {returnfalse }if !(.Name == "") {returnfalse }if !(.Username == "") {returnfalse }if !(.ManagerID == nil) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *BotsCreateBotRequest) () string {if == nil {return"BotsCreateBotRequest(nil)" }typeBotsCreateBotRequestreturnfmt.Sprintf("BotsCreateBotRequest%+v", (*))}// FillFrom fills BotsCreateBotRequest from given interface.func ( *BotsCreateBotRequest) ( interface { () ( bool) () ( string) () ( string) () ( InputUserClass)}) { .ViaDeeplink = .() .Name = .() .Username = .() .ManagerID = .()}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*BotsCreateBotRequest) () uint32 {returnBotsCreateBotRequestTypeID}// TypeName returns name of type in TL schema.func (*BotsCreateBotRequest) () string {return"bots.createBot"}// TypeInfo returns info about TL type.func ( *BotsCreateBotRequest) () tdp.Type { := tdp.Type{Name: "bots.createBot",ID: BotsCreateBotRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "ViaDeeplink",SchemaName: "via_deeplink",Null: !.Flags.Has(0), }, {Name: "Name",SchemaName: "name", }, {Name: "Username",SchemaName: "username", }, {Name: "ManagerID",SchemaName: "manager_id", }, }return}// SetFlags sets flags for non-zero fields.func ( *BotsCreateBotRequest) () {if !(.ViaDeeplink == false) { .Flags.Set(0) }}// Encode implements bin.Encoder.func ( *BotsCreateBotRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode bots.createBot#e5b17f2b as nil") } .PutID(BotsCreateBotRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *BotsCreateBotRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode bots.createBot#e5b17f2b as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode bots.createBot#e5b17f2b: field flags: %w", ) } .PutString(.Name) .PutString(.Username)if .ManagerID == nil {returnfmt.Errorf("unable to encode bots.createBot#e5b17f2b: field manager_id is nil") }if := .ManagerID.Encode(); != nil {returnfmt.Errorf("unable to encode bots.createBot#e5b17f2b: field manager_id: %w", ) }returnnil}// Decode implements bin.Decoder.func ( *BotsCreateBotRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode bots.createBot#e5b17f2b to nil") }if := .ConsumeID(BotsCreateBotRequestTypeID); != nil {returnfmt.Errorf("unable to decode bots.createBot#e5b17f2b: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *BotsCreateBotRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode bots.createBot#e5b17f2b to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode bots.createBot#e5b17f2b: field flags: %w", ) } } .ViaDeeplink = .Flags.Has(0) { , := .String()if != nil {returnfmt.Errorf("unable to decode bots.createBot#e5b17f2b: field name: %w", ) } .Name = } { , := .String()if != nil {returnfmt.Errorf("unable to decode bots.createBot#e5b17f2b: field username: %w", ) } .Username = } { , := DecodeInputUser()if != nil {returnfmt.Errorf("unable to decode bots.createBot#e5b17f2b: field manager_id: %w", ) } .ManagerID = }returnnil}// SetViaDeeplink sets value of ViaDeeplink conditional field.func ( *BotsCreateBotRequest) ( bool) {if { .Flags.Set(0) .ViaDeeplink = true } else { .Flags.Unset(0) .ViaDeeplink = false }}// GetViaDeeplink returns value of ViaDeeplink conditional field.func ( *BotsCreateBotRequest) () ( bool) {if == nil {return }return .Flags.Has(0)}// GetName returns value of Name field.func ( *BotsCreateBotRequest) () ( string) {if == nil {return }return .Name}// GetUsername returns value of Username field.func ( *BotsCreateBotRequest) () ( string) {if == nil {return }return .Username}// GetManagerID returns value of ManagerID field.func ( *BotsCreateBotRequest) () ( InputUserClass) {if == nil {return }return .ManagerID}// BotsCreateBot invokes method bots.createBot#e5b17f2b returning error if any.// Create a managed bot »¹ owned by the current user and controlled by the specified// manager bot.//// Links:// 1. https://core.telegram.org/api/bots/managed-bots#creating-a-managed-bot//// Possible errors://// 400 BOT_CREATE_LIMIT_EXCEEDED: The current user already owns the maximum allowed number of owned bots, as specified by bots_create_limit_default » and bots_create_limit_premium »; if the current user doesn't have Telegram Premium, upgrading to Premium will allow them to create more bots.// 400 MANAGER_INVALID: The specified manager bot is invalid.// 400 MANAGER_PERMISSION_MISSING: The specified manager bot does not have the user.bot_can_manage_bots flag set.// 400 NAME_INVALID: The specified bot name is invalid.// 400 USERNAME_INVALID: The provided username is not valid.// 400 USERNAME_OCCUPIED: The provided username is already occupied.// 400 USERNAME_SUFFIX_MISSING: The required bot suffix is missing from the passed username.//// See https://core.telegram.org/method/bots.createBot for reference.func ( *Client) ( context.Context, *BotsCreateBotRequest) (UserClass, error) {varUserBoxif := .rpc.Invoke(, , &); != nil {returnnil, }return .User, nil}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.