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

GetDialogs fails with error #585

Open
klinki opened this issue Sep 21, 2023 · 1 comment · May be fixed by #611
Open

GetDialogs fails with error #585

klinki opened this issue Sep 21, 2023 · 1 comment · May be fixed by #611

Comments

@klinki
Copy link

klinki commented Sep 21, 2023

Hi, I have following code

          const dialogs: TotalList<Dialog> = await client.getDialogs({          });

and it fails with following error:

TypeError: Cannot read properties of undefined (reading 'date')
at new Dialog (https://deno.land/x/gram@0.8.4/tl/custom/dialog.ts:40:31)
at _DialogsIter._loadNextChunk (https://deno.land/x/gram@0.8.4/client/dialogs.ts:139:20)
at eventLoopTick (ext:core/01_core.js:183:11)
at async Object.next (https://deno.land/x/gram@0.8.4/request_iter.ts:69:29)
at async Module.getDialogs (https://deno.land/x/gram@0.8.4/client/dialogs.ts:210:20)
at async file:///C:/projects/telegram-bot/main.ts:38:46

It seems message could be null and this.date = this.message!.date!; it will fail here in that case.

@baumschubser
Copy link

Same is happening to me. Seems odd that the possibility of message === undefined is ruled out, here.

That line is called from here. message is the dialog's top message and it can be undefined. In that case message.originalMessage is undefined, too, and thats the object that is undefined in the error cited above.

baumschubser pushed a commit to baumschubser/gramjs that referenced this issue Nov 20, 2023
@baumschubser baumschubser linked a pull request Nov 20, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants