Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference - Test with example echo_bot/main.go #19

Open
DiMiTriFrog opened this issue Nov 17, 2022 · 24 comments

Comments

@DiMiTriFrog
Copy link

I'm having this output trying to run the example of echo_bot.
macOs 13.0
go version go1.19.3 darwin/amd64

First time bot asked for code, I logged in and receive that user start, but when I type some and send from a contact to the tg user i'm using as bot i'm receiving this output...

Screenshot 2022-11-17 at 19 10 14

@ALiwoto
Copy link
Collaborator

ALiwoto commented Nov 17, 2022

Hi @DiMiTriFrog, thanks for reporting the issue.
Your screenshot does not show whole traceback, can you please copy paste the whole error traceback and send it here (as text)?

@DiMiTriFrog
Copy link
Author

DiMiTriFrog commented Nov 17, 2022

Sure, thanks!

GoTGProto v1.0.0-beta08, Copyright (C) 2022 Anony <github.com/anonyindian>
Licensed under the terms of GNU General Public License v3

Client has been started...
2022/11/17 19:07:55 runtime error: invalid memory address or nil pointer dereference
goroutine 54 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).handleUpdates.func1()
	/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:109 +0x94
panic({0x100ce78c0, 0x101938700})
	/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).handleUpdates(0xc0001c1530, {0x1010eb1f8?, 0xc0001a35c0}, {0x1, 0xc0005d00c0, 0xc0005d00f0, 0xc0005d0120}, {0x1010f9298, 0xc0135a2020})
	/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:127 +0x3cf
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).dispatch(...)
	/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:100
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).Handle(0xc0005de000?, {0x1010eb1f8, 0xc0001a35c0}, {0x1010f9d18?, 0xc0000d3158})
	/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:91 +0x38a
github.com/gotd/td/telegram.(*Client).processUpdates(0xc000141000, {0x1010f9dd8?, 0xc0005de000?})
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/handle_updates.go:35 +0x37c
github.com/gotd/td/telegram.(*Client).handleUpdates(0xc0005dbc80?, 0x1009fadbe?)
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/handle_updates.go:53 +0x5f
github.com/gotd/td/telegram.clientHandler.OnMessage({0x100ec738f?}, 0xe?)
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/conn_builder.go:26 +0x19
github.com/gotd/td/telegram/internal/manager.(*Conn).OnMessage(0xbef9a0bf9180490e?, 0x100ec738f?)
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/internal/manager/conn.go:169 +0x28
github.com/gotd/td/internal/mtproto.(*Conn).handleMessage(0xc0002d6580, 0x6376787bb3d03c01, 0xc0000d3128)
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/handle_message.go:41 +0x306
github.com/gotd/td/internal/mtproto.(*Conn).consumeMessage(0xc0002d6580, {0x1010eb1f8, 0xc00b57e0c0}, 0x0?)
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:83 +0x293
github.com/gotd/td/internal/mtproto.(*Conn).readLoop.func2()
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:207 +0x8e
created by github.com/gotd/td/internal/mtproto.(*Conn).readLoop
	/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:198 +0x2d8

@celestix
Copy link
Owner

celestix commented Nov 17, 2022

Hey @DiMiTriFrog! Can you check its behaviour in a group chat and does it work fine for non contacts?

Please also send a screenshot of what you exactly did when this panic occurred in telegram.

@DiMiTriFrog
Copy link
Author

DiMiTriFrog commented Nov 17, 2022

Sure. When these logs was when I sent some directly, but same error when I send message to group that contains the TG ID using like a bot.

2022/11/17 22:51:28 runtime error: invalid memory address or nil pointer dereference
goroutine 25 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).handleUpdates.func1()
/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:109 +0x94
panic({0x100ce78c0, 0x101938700})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).handleUpdates(0xc000237530, {0x1010eb1f8?, 0xc0002195c0}, {0x1, 0xc026686060, 0xc026686090, 0xc0266860c0}, {0x1010f9298, 0xc00020c000})
/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:127 +0x3cf
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).dispatch(...)
/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:100
github.com/anonyindian/gotgproto/dispatcher.(*CustomDispatcher).Handle(0xc02668e000?, {0x1010eb1f8, 0xc0002195c0}, {0x1010f9d18?, 0xc026684048})
/Users/otherusernotme/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta08/dispatcher/dispatcher.go:91 +0x38a
github.com/gotd/td/telegram.(*Client).processUpdates(0xc0001b7000, {0x1010f9d78?, 0xc02668e000?})
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/handle_updates.go:37 +0x10a
github.com/gotd/td/telegram.(*Client).handleUpdates(0xc016fdbc80?, 0x1009fadbe?)
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/handle_updates.go:53 +0x5f
github.com/gotd/td/telegram.clientHandler.OnMessage({0x100ec738f?}, 0xe?)
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/conn_builder.go:26 +0x19
github.com/gotd/td/telegram/internal/manager.(*Conn).OnMessage(0xbef9a0bf9180490e?, 0x100ec738f?)
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/telegram/internal/manager/conn.go:169 +0x28
github.com/gotd/td/internal/mtproto.(*Conn).handleMessage(0xc00035a580, 0x6376ace092494801, 0xc026684018)
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/handle_message.go:41 +0x306
github.com/gotd/td/internal/mtproto.(*Conn).consumeMessage(0xc00035a580, {0x1010eb1f8, 0xc013488040}, 0x76?)
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:83 +0x293
github.com/gotd/td/internal/mtproto.(*Conn).readLoop.func2()
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:207 +0x8e
created by github.com/gotd/td/internal/mtproto.(*Conn).readLoop
/Users/otherusernotme/go/pkg/mod/github.com/gotd/td@v0.62.0/internal/mtproto/read.go:198 +0x2d8

Direct DM
Screenshot 2022-11-17 at 22 50 23

From Group
Screenshot 2022-11-17 at 22 53 50

@celestix
Copy link
Owner

celestix commented Nov 19, 2022

Hey @DiMiTriFrog, sorry for the late reply! I tried to reproduce this panic but couldn't, example worked very fine in my case. Looks like something went wrong at your side while writing the session to the file. Please delete the echobot.session and try again.

@DiMiTriFrog
Copy link
Author

Same... What SO are you using? I will try with server with same SO than you to try if works, maybe my mac is down.

@celestix
Copy link
Owner

celestix commented Nov 20, 2022

Same... What SO are you using? I will try with server with same SO than you to try if works, maybe my mac is down.

Sorry, but what do you mean by "SO"?
I used GitHub codespace to test it btw...

@DiMiTriFrog
Copy link
Author

Same... What SO are you using? I will try with server with same SO than you to try if works, maybe my mac is down.

Sorry, but what do you mean by "SO"? I used GitHub codespace to test it btw...

Operating system
The isue is still showing, i found that its showing when try to reply a message, so cant reply.
For me is okey because only want to process message.
This is working well:
Screenshot 2022-11-20 at 11 22 39

@celestix
Copy link
Owner

Oh, It seems like the problem is associated with the modifications you're making to echobot example. It's working fine for me for all cases including replying to a message.

@DiMiTriFrog
Copy link
Author

DiMiTriFrog commented Nov 20, 2022

Oh, It seems like the problem is associated with the modifications you're making to echobot example. It's working fine for me for all cases including replying to a message.

No... This issue post was copying the echo bot, but i'm using the api of telegram not botfather, so I removed the handles of callback buttons from code let just the echo function and handle (I tried without removing it and same issue).
Now removing the reply function the code is working as I want, but i'm not able for reply.

@celestix
Copy link
Owner

Oh, It seems like the problem is associated with the modifications you're making to echobot example. It's working fine for me for all cases including replying to a message.

No... This issue post was copying the echo bot, but i'm using the api of telegram not botfather, so I removed the handles of callback buttons from code let just the echo function and handle (I tried without removing it and same issue). Now removing the reply function the code is working as I want, but i'm not able for reply.

Do you mean, you were trying to use that example for a user account instead of a telegram bot?

@DiMiTriFrog
Copy link
Author

Oh, It seems like the problem is associated with the modifications you're making to echobot example. It's working fine for me for all cases including replying to a message.

No... This issue post was copying the echo bot, but i'm using the api of telegram not botfather, so I removed the handles of callback buttons from code let just the echo function and handle (I tried without removing it and same issue). Now removing the reply function the code is working as I want, but i'm not able for reply.

Do you mean, you were trying to use that example for a user account instead of a telegram bot?

Right

@celestix
Copy link
Owner

Oh, It seems like the problem is associated with the modifications you're making to echobot example. It's working fine for me for all cases including replying to a message.

No... This issue post was copying the echo bot, but i'm using the api of telegram not botfather, so I removed the handles of callback buttons from code let just the echo function and handle (I tried without removing it and same issue). Now removing the reply function the code is working as I want, but i'm not able for reply.

Do you mean, you were trying to use that example for a user account instead of a telegram bot?

Right

Oh, You should have told this before, I was assuming that you're trying it over a bot all the way because that example was written in view of bots.

Please give me some time to test echobot example on a user account, I'll notify you once done.

@sarff
Copy link

sarff commented Jan 29, 2023

for fix issue:

func start(ctx *ext.Context, update *ext.Update) error {
	user := update.EffectiveUser()
	_, _ = ctx.Reply(update, fmt.Sprintf("Hello %s, I am @%s and will repeat all your messages.\nI was made using gotd and gotgproto.", user.FirstName, ctx.Self.Username), &ext.ReplyOpts{
		Markup: &tg.ReplyInlineMarkup{
			Rows: []tg.KeyboardButtonRow{
				{
					Buttons: []tg.KeyboardButtonClass{
						&tg.KeyboardButtonURL{
							Text: "gotd/td",
							URL:  "https://github.com/gotd/td",
						},
						&tg.KeyboardButtonURL{
							Text: "gotgproto",
							URL:  "https://github.com/anonyindian/gotgproto",
						},
					},
				},
				{
					Buttons: []tg.KeyboardButtonClass{
						&tg.KeyboardButtonCallback{
							Text: "Click Here",
							Data: []byte("cb_pressed"),
						},
					},
				},
			},
		},
	},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups
}

@celestix
Copy link
Owner

for fix issue:

func start(ctx *ext.Context, update *ext.Update) error {
	user := update.EffectiveUser()
	_, _ = ctx.Reply(update, fmt.Sprintf("Hello %s, I am @%s and will repeat all your messages.\nI was made using gotd and gotgproto.", user.FirstName, ctx.Self.Username), &ext.ReplyOpts{
		Markup: &tg.ReplyInlineMarkup{
			Rows: []tg.KeyboardButtonRow{
				{
					Buttons: []tg.KeyboardButtonClass{
						&tg.KeyboardButtonURL{
							Text: "gotd/td",
							URL:  "https://github.com/gotd/td",
						},
						&tg.KeyboardButtonURL{
							Text: "gotgproto",
							URL:  "https://github.com/anonyindian/gotgproto",
						},
					},
				},
				{
					Buttons: []tg.KeyboardButtonClass{
						&tg.KeyboardButtonCallback{
							Text: "Click Here",
							Data: []byte("cb_pressed"),
						},
					},
				},
			},
		},
	},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups
}

Sorry, but what's the difference in it and the original example?

@sarff
Copy link

sarff commented Jan 29, 2023

original:

})
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

fix:

},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

@celestix
Copy link
Owner

original:

})
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

fix:

},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

I still don't understand what you mean, please elaborate a bit.

@sarff
Copy link

sarff commented Feb 6, 2023

original:

})
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

fix:

},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

I still don't understand what you mean, please elaborate a bit.

I had the same problem. I put a comma - that's the only difference. After that I ran the code without errors

@celestix
Copy link
Owner

celestix commented Feb 7, 2023

original:

})
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

fix:

},
	)
	// End dispatcher groups so that bot doesn't echo /start command usage
	return dispatcher.EndGroups

I still don't understand what you mean, please elaborate a bit.

I had the same problem. I put a comma - that's the only difference. After that I ran the code without errors

Eh, doesn't seem like that comma was the culprit, probably something goes wrong conditionally during the runtime handling. But the comma, nah I don't think so.

@celestix
Copy link
Owner

Hello @DiMiTriFrog, Please tell if you're still facing this problem.

@TeaDove
Copy link
Contributor

TeaDove commented Jul 8, 2023

I face the same issue.

type Presentation struct {
	telegramClient  *telegram.Client
	telegramSender  *message.Sender
	telegramApi     *tg.Client
	telegramManager *peers.Manager
	protoClient     *gotgproto.Client

	storage       storage.Interface
	clientService *client.Service
}

func MustNewTelegramPresentation(
	clientService *client.Service,
	telegramAppID int,
	telegramAppHash string,
	telegramPhoneNumber string,
	telegramSessionStorageFullPath string,
	storage storage.Interface,
) Presentation {

	protoClient, err := gotgproto.NewClient(telegramAppID, telegramAppHash, gotgproto.ClientType{
		Phone: telegramPhoneNumber,
	}, &gotgproto.ClientOpts{
		DisableCopyright: true,
		Session:          sessionMaker.NewSession(telegramSessionStorageFullPath, sessionMaker.Session),
	})
	utils.Check(err)
	protoClient.Dispatcher.AddHandler(handlers.NewCommand("echo", echo))

	api := protoClient.API()

	presentation := Presentation{
		clientService:   clientService,
		storage:         storage,
		protoClient:     protoClient,
		telegramApi:     api,
		telegramSender:  message.NewSender(api),
		telegramManager: peers.Options{}.Build(api),
	}
	return presentation
}

func echo(ctx *ext.Context, update *ext.Update) error {
	_, err := ctx.Reply(update, update.EffectiveMessage, nil)
	return err
}

func (r *Presentation) Run() error {
	ctx := r.protoClient.CreateContext()
	_, err := ctx.SendMessage(ctx.Self.ID, &tg.MessagesSendMessageRequest{Message: "Fun telegram initialized!"})
	if err != nil {
		return err
	}

	err = r.protoClient.Idle()
	return err
}

Bot correctly sends Fun telegram initialized, but after command /echo it fails with NPE

2023/07/09 00:02:52 runtime error: invalid memory address or nil pointer dereference
goroutine 65 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate.func2()
        /Users/teadove/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta10/dispatcher/dispatcher.go:139 +0x94
panic({0x100e63b20, 0x101c5da90})
        /usr/local/go/src/runtime/panic.go:884 +0x213
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate(0xc0001a0b40, {0x1012ca7c0?, 0xc000506000}, {0x0, 0xc0003bb620, 0xc0003bb680, 0xc0003bb6e0}, {0x1012da8f8, 0xc000402280})
        /Users/teadove/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta10/dispatcher/dispatcher.go:160 +0x44e
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).dispatch(...)
        /Users/teadove/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta10/dispatcher/dispatcher.go:125
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).Handle(0xc0000be7e0?, {0x1012ca7c0, 0xc000506000}, {0x1012dba98?, 0xc0000be7e0})
        /Users/teadove/go/pkg/mod/github.com/anonyindian/gotgproto@v1.0.0-beta10/dispatcher/dispatcher.go:116 +0x333
github.com/gotd/td/telegram.(*Client).processUpdates(0xc0004b2400, {0x1012dba98?, 0xc0000be7e0?})
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/telegram/handle_updates.go:27 +0x5ba
github.com/gotd/td/telegram.(*Client).handleUpdates(0xc0001bbc80?, 0x1009cbdde?)
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/telegram/handle_updates.go:53 +0x5f
github.com/gotd/td/telegram.clientHandler.OnMessage({0x10108a061?}, 0xe?)
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/telegram/conn_builder.go:26 +0x19
github.com/gotd/td/telegram/internal/manager.(*Conn).OnMessage(0x10001092a?, 0x10108a061?)
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/telegram/internal/manager/conn.go:169 +0x28
github.com/gotd/td/internal/mtproto.(*Conn).handleMessage(0xc0005382c0, 0x64a9cefceb664401, 0xc0001ac498)
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/mtproto/handle_message.go:41 +0x306
github.com/gotd/td/internal/mtproto.(*Conn).consumeMessage(0xc0005382c0, {0x1012ca7c0, 0xc000498d70}, 0x0?)
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/mtproto/read.go:83 +0x293
github.com/gotd/td/internal/mtproto.(*Conn).readLoop.func2()
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/mtproto/read.go:207 +0x8e
created by github.com/gotd/td/internal/mtproto.(*Conn).readLoop
        /Users/teadove/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/mtproto/read.go:198 +0x2d8

Full code locates here: https://github.com/TeaDove/fun-telegram/blob/feature/persistent-storage/internal/presentation/telegram/telegram.go

Ty in advance for any help!

@TeaDove
Copy link
Contributor

TeaDove commented Jul 8, 2023

btw, same thing with example echo-bot.
Start command works okay, echo - raises NPE.

client (@teas_teleout_bot) has been started...
2023/07/09 00:17:37 runtime error: invalid memory address or nil pointer dereference
goroutine 82 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate.func2()
	/Users/teadove/projects/gotgproto/dispatcher/dispatcher.go:139 +0x94
panic({0x100dc2500, 0x101b1c130})
	/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate(0xc0001a8840, {0x1011fd090?, 0xc0004345f0}, {0x0, 0xc000192b40, 0xc000192ba0, 0xc000192c30}, {0x10120ca18, 0xc000254000})
	/Users/teadove/projects/gotgproto/dispatcher/dispatcher.go:160 +0x44e
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).dispatch(...)
	/Users/teadove/projects/gotgproto/dispatcher/dispatcher.go:125
github.com/anonyindian/gotgproto/dispatcher.(*NativeDispatcher).Handle(0xc000758060?, {0x1011fd090, 0xc0004345f0}, {0x10120dbb8?, 0xc000758060})
	/Users/teadove/projects/gotgproto/dispatcher/dispatcher.go:116 +0x333
github.com/gotd/td/telegram.(*Client).processUpdates(0xc0001cbc00, {0x10120dbb8?, 0xc000758060?})
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/telegram/handle_updates.go:27 +0x5ba
github.com/gotd/td/telegram.(*Client).handleUpdates(0xc000131ba8?, 0x100ab6abe?)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/telegram/handle_updates.go:53 +0x5f
github.com/gotd/td/telegram.clientHandler.OnMessage({0x100fd1902?}, 0xe?)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/telegram/conn_builder.go:26 +0x19
github.com/gotd/td/telegram/internal/manager.(*Conn).OnMessage(0xc000740000?, 0x100fd1902?)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/telegram/internal/manager/conn.go:169 +0x28
github.com/gotd/td/internal/mtproto.(*Conn).handleMessage(0xc000474000, 0x64a9d27191e4bc01, 0xc0000b6138)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/handle_message.go:41 +0x306
github.com/gotd/td/internal/mtproto.(*Conn).handleGZIP(0x10000eb2a?, 0x100fd1902?, 0x18?)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/handle_gzip.go:23 +0x65
github.com/gotd/td/internal/mtproto.(*Conn).handleMessage(0xc000474000, 0x64a9d27191e4bc01, 0xc0000b60a8)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/handle_message.go:36 +0x195
github.com/gotd/td/internal/mtproto.(*Conn).consumeMessage(0xc000474000, {0x1011fd090, 0xc0001082d0}, 0xc000758000?)
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/read.go:83 +0x293
github.com/gotd/td/internal/mtproto.(*Conn).readLoop.func2()
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/read.go:207 +0x8e
created by github.com/gotd/td/internal/mtproto.(*Conn).readLoop
	/Users/teadove/go/pkg/mod/github.com/gotd/td@v0.82.0/internal/mtproto/read.go:198 +0x2d8
image

@TeaDove
Copy link
Contributor

TeaDove commented Jul 9, 2023

bloody interface{} :(

The problem was with text interface{} argument in ctx.Reply(), I just need to change it to _, err := ctx.Reply(update, update.EffectiveMessage.Message.Message, nil)

@celestix
Copy link
Owner

celestix commented Jul 10, 2023

bloody interface{} :(

The problem was with text interface{} argument in ctx.Reply(), I just need to change it to _, err := ctx.Reply(update, update.EffectiveMessage.Message.Message, nil)

Agreed! I should handle it some other way, a raw interface is really very error-prone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants