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`
|
|
|
|
- SQLite storage (`@mtcute/sqlite`)
|
|
|
|
- TCP transport
|
|
|
|
- `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
|
|
|
|
|
|
|
tg.run(async (user) => {
|
|
|
|
console.log(`✨ logged in as ${user.displayName}`)
|
|
|
|
})
|
2022-08-24 23:37:26 +03:00
|
|
|
```
|