mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
Update README.md
This commit is contained in:
parent
110fa34e67
commit
d4a7393b51
1 changed files with 7 additions and 1 deletions
|
@ -116,7 +116,11 @@ async fn main() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
Commands are defined similar to how we define CLI using [structopt] and JSON structures in [serde-json]. The following bot accepts either `/username YourUsername`, `/usernameandage YourUsername YourAge` and shows the usage guide on `/help`:
|
Commands are strongly typed and defined declaratively, similar to how we define CLI using [structopt] and JSON structures in [serde-json]. The following bot accepts these commands:
|
||||||
|
|
||||||
|
- `/username <your username>`
|
||||||
|
- `/usernameandage <your username> <your age>`
|
||||||
|
- `/help`
|
||||||
|
|
||||||
[structopt]: https://docs.rs/structopt/0.3.9/structopt/
|
[structopt]: https://docs.rs/structopt/0.3.9/structopt/
|
||||||
[serde-json]: https://github.com/serde-rs/json
|
[serde-json]: https://github.com/serde-rs/json
|
||||||
|
@ -303,6 +307,8 @@ pub async fn receive_gandalf_alternative_name(
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
And, finally, the `main` function looks like this:
|
||||||
|
|
||||||
([dialogue_bot/src/main.rs](https://github.com/teloxide/teloxide/blob/master/examples/dialogue_bot/src/main.rs))
|
([dialogue_bot/src/main.rs](https://github.com/teloxide/teloxide/blob/master/examples/dialogue_bot/src/main.rs))
|
||||||
```rust
|
```rust
|
||||||
// Imports are omitted...
|
// Imports are omitted...
|
||||||
|
|
Loading…
Add table
Reference in a new issue