Skip to content

Conversation

@vanodevium
Copy link

#698 #601

Even I try to make import as you wrote in you documentation

import { TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";
import { NewMessageEvent } from "telegram/events";

I have problem with exports and ERR_UNSUPPORTED_DIR_IMPORT

So please inject events into main exported object.

It will fix many problems with Events as minimum.

Thanx!

@painor
Copy link
Member

painor commented Dec 25, 2024

as a workaround you can do.

  client.addEventHandler((message) => {
        console.log(message);
    }, new TelegramClient.events.NewMessage());

You don't need to import events like this.

@vanodevium
Copy link
Author

@painor

Thanx. It works but as workaround.

In general I wanna completely without errors use string

import { NewMessageEvent } from "telegram/events";

Is is possible?

@painor
Copy link
Member

painor commented Dec 25, 2024

Last time I tried that i ended up with some recursive errors so I have to restructure the imports a bit to make it work for now.
So it'll take some time to update that

@vanodevium
Copy link
Author

@painor Please mention me for testing when it would be done.

Thanx!

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 this pull request may close these issues.

2 participants