2024-02-03 13:26:21 +03:00
|
|
|
const { MemoryStorage } = require('@mtcute/core')
|
2024-03-01 18:16:07 +03:00
|
|
|
const { setPlatform } = require('@mtcute/core/platform.js')
|
2023-12-02 04:10:31 +03:00
|
|
|
const { LogManager } = require('@mtcute/core/utils.js')
|
2024-04-25 15:37:04 +03:00
|
|
|
const { NodePlatform, TcpTransport } = require('@mtcute/node')
|
|
|
|
const { NodeCryptoProvider } = require('@mtcute/node/utils.js')
|
2023-12-01 15:03:11 +03:00
|
|
|
|
2023-10-16 19:23:53 +03:00
|
|
|
exports.getApiParams = () => {
|
|
|
|
if (!process.env.API_ID || !process.env.API_HASH) {
|
|
|
|
throw new Error('API_ID and API_HASH env variables must be set')
|
|
|
|
}
|
|
|
|
|
2024-03-01 18:16:07 +03:00
|
|
|
setPlatform(new NodePlatform())
|
|
|
|
|
2023-10-16 19:23:53 +03:00
|
|
|
return {
|
|
|
|
apiId: parseInt(process.env.API_ID),
|
|
|
|
apiHash: process.env.API_HASH,
|
|
|
|
testMode: true,
|
2023-12-01 15:03:11 +03:00
|
|
|
storage: new MemoryStorage(),
|
2023-12-02 04:10:31 +03:00
|
|
|
logLevel: LogManager.DEBUG,
|
2024-03-01 18:16:07 +03:00
|
|
|
transport: () => new TcpTransport(),
|
|
|
|
crypto: new NodeCryptoProvider(),
|
2023-10-16 19:23:53 +03:00
|
|
|
}
|
|
|
|
}
|