mtcute/packages/node/README.md

28 lines
645 B
Markdown
Raw Normal View History

# @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
## Usage
```typescript
2024-03-06 21:20:44 +03:00
import { TelegramClient } from '@mtcute/node'
2024-03-06 21:20:44 +03:00
const tg = new TelegramClient({
apiId: 12345,
apiHash: 'abcdef',
2023-11-01 14:05:45 +03:00
storage: 'my-account'
})
tg.run(async (user) => {
console.log(`✨ logged in as ${user.displayName}`)
})
```