Closed Cristuker closed 1 week ago
As the error says, the library only supports ESM. You'll need to set up your tsconfig accordingly.
You can also access bot.agent
instead of initializing your own.
Well I do some research and I have same error yet. SUggestions?
{
"compilerOptions": {
"target": "ESNext",
"lib": ["es6"],
"module": "commonjs",
"rootDir": "src",
"resolveJsonModule": true,
"allowJs": false,
"outDir": "build",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": false,
"skipLibCheck": true,
"isolatedModules": true,
"moduleResolution": "Node",
}
}
As the error says, the library only supports ESM. You'll need to set up your tsconfig accordingly.
You can also access
bot.agent
instead of initializing your own.
I will do this
Try "module": "esnext"
. You can look up TypeScript configs for Node with ESM — this isn't really relevant to the library, so I'm going to close this issue.
I'm trying to use this with TS and I'm find some problems. So yes it's really relevant. I don't have this kind of problem with others lib
Like I said, there are plenty of guides available online to help you set up your project for ESM, here's one.
instead of initializing your own.
I want but I can't pass
persistSession: async (evt: string, session: AtpSessionData | undefined) => {
await saveSession(JSON.stringify(session));
console.log('Persist session');
}
to bot agent. I need do this to save my session and avoid break rate limit
You can persist the result of Bot.login()
and pass that to resumeSession
— will add that as an option though.
I have this source code
and when I run I receive this error on terminal