Open DiMiTriFrog opened 2 years ago
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)?
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
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.
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
From Group
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.
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.
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...
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:
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.
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.
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?
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, 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.
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
}
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?
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
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.
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
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.
Hello @DiMiTriFrog, Please tell if you're still facing this problem.
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!
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
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)
bloody
interface{}
:(The problem was with
text interface{}
argument inctx.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.
I kind of facing similar when uploading an audio file here is the trace
2024/11/24 14:10:49 runtime error: invalid memory address or nil pointer dereference
goroutine 48 [running]:
runtime/debug.Stack()
C:/Users/sayee/scoop/apps/go/current/src/runtime/debug/stack.go:26 +0x5e
github.com/celestix/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate.func1()
C:/Users/sayee/go/pkg/mod/github.com/celestix/gotgproto@v1.0.0-beta18/dispatcher/dispatcher.go:147 +0x91
panic({0x16fee20?, 0x1f52020?})
C:/Users/sayee/scoop/apps/go/current/src/runtime/panic.go:785 +0x132
main.song(0xc0002d60a0, 0xc00041c5a0)
D:/github/go-tg-bot/tg-cmds.go:79 +0x4e1
github.com/celestix/gotgproto/dispatcher/handlers.Command.CheckUpdate({{0x1ef23f8, 0x2, 0x2}, {0x18270be, 0x4}, 0x18d46c8, 0x1, 0x0}, 0xc0002d60a0, 0xc00041c5a0)
C:/Users/sayee/go/pkg/mod/github.com/celestix/gotgproto@v1.0.0-beta18/dispatcher/handlers/commands.go:49 +0x2a9
github.com/celestix/gotgproto/dispatcher.(*NativeDispatcher).handleUpdate(0xc0002a8f60, {0x19c7748, 0xc0002d7cc0}, {0x0, 0xc00041e6f0, 0xc00041e720, 0xc00041e750}, {0x19ca980, 0xc0004163c0})
C:/Users/sayee/go/pkg/mod/github.com/celestix/gotgproto@v1.0.0-beta18/dispatcher/dispatcher.go:158 +0x2d2
github.com/celestix/gotgproto/dispatcher.(*NativeDispatcher).dispatch(...)
C:/Users/sayee/go/pkg/mod/github.com/celestix/gotgproto@v1.0.0-beta18/dispatcher/dispatcher.go:137
github.com/celestix/gotgproto/dispatcher.(*NativeDispatcher).Handle(0xc0002a8f60, {0x19c7748, 0xc0002d7cc0}, {0x19cb4c0?, 0xc000434600})
C:/Users/sayee/go/pkg/mod/github.com/celestix/gotgproto@v1.0.0-beta18/dispatcher/dispatcher.go:128 +0x34c
github.com/gotd/td/telegram.(*Client).processUpdates(0xc0002dad88, {0x19cb4c0?, 0xc000434600})
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/telegram/handle_updates.go:27 +0x53c
github.com/gotd/td/telegram.(*Client).handleUpdates(0xc0002dad88, 0x139b658?)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/telegram/handle_updates.go:53 +0x52
github.com/gotd/td/telegram.clientHandler.OnMessage({0x182d397?}, 0xe?)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/telegram/conn_builder.go:26 +0x13
github.com/gotd/td/telegram/internal/manager.(*Conn).OnMessage(0x0?, 0x182d397?)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/telegram/internal/manager/conn.go:175 +0x22
github.com/gotd/td/mtproto.(*Conn).handleMessage(0xc0001a9348, 0x6742e663b1169001, 0xc0004106c0)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/handle_message.go:41 +0x2cc
github.com/gotd/td/mtproto.(*Conn).handleGZIP(0xc0001a9348, 0x6742e663b1169001, 0xc91c82159beca5a7?)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/handle_gzip.go:23 +0x5d
github.com/gotd/td/mtproto.(*Conn).handleMessage(0xc0001a9348, 0x6742e663b1169001, 0xc000410660)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/handle_message.go:36 +0x195
github.com/gotd/td/mtproto.(*Conn).consumeMessage(0xc0001a9348, {0x19c7748, 0xc00041c0a0}, 0xc000428040?)
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/read.go:83 +0x276
github.com/gotd/td/mtproto.(*Conn).readLoop.func2()
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/read.go:207 +0x86
created by github.com/gotd/td/mtproto.(*Conn).readLoop in goroutine 40
C:/Users/sayee/go/pkg/mod/github.com/gotd/td@v0.112.0/mtproto/read.go:198 +0x2a7
Here is the code
f, err := uploader.NewUploader(ctx.Raw).FromPath(ctx, songInfo.Path)
if err != nil {
panic(err)
}
media := &tg.InputMediaUploadedDocument{
File: f,
MimeType: "audio/mp4",
Attributes: []tg.DocumentAttributeClass{
&tg.DocumentAttributeFilename{FileName: songInfo.Title},
&tg.DocumentAttributeAudio{
Duration: songInfo.Duration / 1000,
Title: songInfo.Title,
Performer: songInfo.Performer,
},
},
}
_, err := ctx.SendMedia(update.GetChat().ID, &tg.MessagesSendMediaRequest{
Media: media,
Message: update.EffectiveUser().Username, // How do I tag the user ?😑
})
@sayeed205 what is written in file D:/github/go-tg-bot/tg-cmds.go:79
in your project? (line 79); the panic is coming from there.
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...