2022-08-24 23:37:26 +03:00
|
|
|
# @mtcute/node
|
|
|
|
|
2023-11-01 14:05:45 +03:00
|
|
|
📖 [API Reference](https://ref.mtcute.dev/modules/_mtcute_node.html)
|
|
|
|
|
2024-03-06 21:20:44 +03:00
|
|
|
Node.js support package for mtcute. Includes:
|
|
|
|
- Support for native crypto addon (must be installed separately, `@mtcute/crypto-node`)
|
|
|
|
- Terminal I/O via `readline`
|
2024-03-23 23:52:11 +03:00
|
|
|
- SQLite storage (via `better-sqlite3`)
|
|
|
|
- TCP transport (via `node:net`)
|
2024-03-06 21:20:44 +03:00
|
|
|
- `TelegramClient` implementation using the above
|
|
|
|
- HTML and Markdown parsers
|
2022-08-24 23:37:26 +03:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```typescript
|
2024-03-06 21:20:44 +03:00
|
|
|
import { TelegramClient } from '@mtcute/node'
|
2022-08-24 23:37:26 +03:00
|
|
|
|
2024-03-06 21:20:44 +03:00
|
|
|
const tg = new TelegramClient({
|
2022-08-24 23:37:26 +03:00
|
|
|
apiId: 12345,
|
|
|
|
apiHash: 'abcdef',
|
2023-11-01 14:05:45 +03:00
|
|
|
storage: 'my-account'
|
2022-08-24 23:37:26 +03:00
|
|
|
})
|
2023-12-13 21:43:46 +03:00
|
|
|
|
2024-07-26 06:46:18 +03:00
|
|
|
const self = await tg.start()
|
|
|
|
console.log(`✨ logged in as ${self.displayName}`)
|
2022-08-24 23:37:26 +03:00
|
|
|
```
|