diff --git a/Cargo.toml b/Cargo.toml index 0235fc94..e2fcd313 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ futures = "0.3.1" pin-project = "0.4.6" serde_with_macros = "1.0.1" -teloxide-macros = "0.3.0" +teloxide-macros = "0.3.1" [dev-dependencies] smart-default = "0.6.0" diff --git a/README.md b/README.md index 038b8329..0fcdab98 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,16 @@ ## Features -

Type safety

+

Functional reactive design

-All the API types and methods are implemented with heavy use of ADTs to enforce type safety and tight integration with IDEs. Bot's commands have precise types too, thereby serving as a self-documenting code and respecting the parse, don't validate programming idiom. +teloxide has functional reactive design, allowing you to declaratively manipulate streams of updates from Telegram using filters, maps, folds, zips, and a lot of other adaptors. +

+ +
+ +

API types as ADTs

+

+All the API types and methods are hand-written, with heavy use of ADTs (algebraic data types) to enforce type safety and tight integration with IDEs. As few Options as possible.


@@ -47,6 +54,15 @@ All the API Dialogues management is independent of how/where they are stored: just replace one line and make them persistent (for example, store on a disk, transmit through a network), without affecting the actual FSM algorithm. By default, teloxide stores all user dialogues in RAM. Default database implementations are coming!

+
+ +

Strongly typed bot commands

+

+You can describe bot commands as enumerations, and then they'll be automatically constructed from strings. Just like you describe JSON structures in serde-json and command-line arguments in structopt. +

+ +
+ ## Setting up your environment 1. [Download Rust](http://rustup.rs/). 2. Create a new bot using [@Botfather](https://t.me/botfather) to get a token in the format `123456789:blablabla`. diff --git a/tests/command.rs b/tests/command.rs index eadb214d..47b3555f 100644 --- a/tests/command.rs +++ b/tests/command.rs @@ -171,3 +171,16 @@ fn parse_named_fields() { DefaultCommands::parse("/start 10 hello", "").unwrap() ); } + +#[test] +fn descriptions_off() { + #[command(rename = "lowercase")] + #[derive(BotCommand, Debug, PartialEq)] + enum DefaultCommands { + #[command(description = "off")] + Start, + Help, + } + + assert_eq!(DefaultCommands::descriptions(), "/help\n".to_owned()); +}