mtcute/packages/dispatcher/README.md

27 lines
695 B
Markdown
Raw Normal View History

2023-11-01 14:05:45 +03:00
# @mtcute/dispatcher
📖 [API Reference](https://ref.mtcute.dev/modules/_mtcute_dispatcher.html)
2023-11-01 14:05:45 +03:00
🧐 [Guide](https://mtcute.dev/guide/dispatcher/intro.html)
2024-03-06 21:20:44 +03:00
Dispatcher and bot framework based on @mtcute/core.
2023-11-01 14:05:45 +03:00
## Features
- **Straightforward**: Simple and expressive API
- **State**: Supports storing state for each chat
- **Filters**: Powerful and easy-to-use filtering system
- **Middleware**: Basic middleware support for updates
- **Scenes**: Built-in support for scenes
## Usage
```ts
2024-03-06 21:33:13 +03:00
import { Dispatcher } from '@mtcute/dispatcher'
2023-11-01 14:05:45 +03:00
2024-03-06 21:20:44 +03:00
const tg = new TelegramClient({ ... })
2023-11-01 14:05:45 +03:00
const dp = Dispatcher.for(tg)
dp.onNewMessage(async (msg) => {
await msg.replyText('Hello world!')
})
```