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)
|
|
|
|
|
2022-08-24 23:37:26 +03:00
|
|
|
All-in-one package for NodeJS. Includes support for native crypto addon
|
|
|
|
(must be installed separately, `@mtcute/crypto-node`), terminal I/O via
|
2023-12-13 21:43:46 +03:00
|
|
|
`readline` and includes HTML and Markdown parsers.
|
2022-08-24 23:37:26 +03:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
import { NodeTelegramClient } from '@mtcute/node'
|
|
|
|
|
|
|
|
const tg = new NodeTelegramClient({
|
|
|
|
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
|
|
|
```
|