mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
Merge branch 'dev' into concrete-error-type-repls
This commit is contained in:
commit
333c88fcb7
4 changed files with 155 additions and 128 deletions
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `AsUpdateStream` now has an associated type `StreamErr` instead of a generic
|
- `AsUpdateStream` now has an associated type `StreamErr` instead of a generic
|
||||||
- Rename `dispatching::stop_token::{AsyncStopToken, AsyncStopFlag}` => `stop::{StopToken, StopFlag}`
|
- Rename `dispatching::stop_token::{AsyncStopToken, AsyncStopFlag}` => `stop::{StopToken, StopFlag}`
|
||||||
- Replace the generic error type `E` with `RequestError` for REPLs (`repl(_with_listener)`, `commands_repl(_with_listener)`)
|
- Replace the generic error type `E` with `RequestError` for REPLs (`repl(_with_listener)`, `commands_repl(_with_listener)`)
|
||||||
|
- The following functions are now `#[must_use]`:
|
||||||
|
- `BotCommands::ty`.
|
||||||
|
- `CommandDescriptions::{new, global_description, username, username_from_me}`.
|
||||||
|
- `teloxide::filter_command`.
|
||||||
|
- `teloxide::dispatching::dialogue::enter`.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
@ -264,6 +269,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## 0.4.0 - 2021-03-22
|
## 0.4.0 - 2021-03-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Integrate [teloxide-core].
|
- Integrate [teloxide-core].
|
||||||
- Allow arbitrary error types to be returned from (sub)transitions ([issue 242](https://github.com/teloxide/teloxide/issues/242)).
|
- Allow arbitrary error types to be returned from (sub)transitions ([issue 242](https://github.com/teloxide/teloxide/issues/242)).
|
||||||
- The `respond` function, a shortcut for `ResponseResult::Ok(())`.
|
- The `respond` function, a shortcut for `ResponseResult::Ok(())`.
|
||||||
|
@ -281,6 +287,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Hide `SubtransitionOutputType` from the docs.
|
- Hide `SubtransitionOutputType` from the docs.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Export `teloxide_macros::teloxide` in `prelude`.
|
- Export `teloxide_macros::teloxide` in `prelude`.
|
||||||
- `dispatching::dialogue::serializer::{JSON -> Json, CBOR -> Cbor}`
|
- `dispatching::dialogue::serializer::{JSON -> Json, CBOR -> Cbor}`
|
||||||
- Allow `bot_name` be `N`, where `N: Into<String> + ...` in `commands_repl` & `commands_repl_with_listener`.
|
- Allow `bot_name` be `N`, where `N: Into<String> + ...` in `commands_repl` & `commands_repl_with_listener`.
|
||||||
|
@ -307,20 +314,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## 0.3.3 - 2020-10-30
|
## 0.3.3 - 2020-10-30
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- The `dice` field from `MessageDice` is public now ([issue 306](https://github.com/teloxide/teloxide/issues/306))
|
- The `dice` field from `MessageDice` is public now ([issue 306](https://github.com/teloxide/teloxide/issues/306))
|
||||||
|
|
||||||
## 0.3.2 - 2020-10-23
|
## 0.3.2 - 2020-10-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `LoginUrl::new` ([issue 298](https://github.com/teloxide/teloxide/issues/298))
|
- `LoginUrl::new` ([issue 298](https://github.com/teloxide/teloxide/issues/298))
|
||||||
|
|
||||||
## 0.3.1 - 2020-08-25
|
## 0.3.1 - 2020-08-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `Bot::builder` method ([PR 269](https://github.com/teloxide/teloxide/pull/269)).
|
- `Bot::builder` method ([PR 269](https://github.com/teloxide/teloxide/pull/269)).
|
||||||
|
|
||||||
## 0.3.0 - 2020-07-31
|
## 0.3.0 - 2020-07-31
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Support for typed bot commands ([issue 152](https://github.com/teloxide/teloxide/issues/152)).
|
- Support for typed bot commands ([issue 152](https://github.com/teloxide/teloxide/issues/152)).
|
||||||
- `BotBuilder`, which allows setting a default `ParseMode`.
|
- `BotBuilder`, which allows setting a default `ParseMode`.
|
||||||
- The `Transition`, `Subtransition`, `SubtransitionOutputType` traits.
|
- The `Transition`, `Subtransition`, `SubtransitionOutputType` traits.
|
||||||
|
@ -342,9 +354,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Respect the `TELOXIDE_PROXY` environment variable in `Bot::from_env`.
|
- Respect the `TELOXIDE_PROXY` environment variable in `Bot::from_env`.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
- `Bot::{from_env_with_client, new, with_client}`
|
- `Bot::{from_env_with_client, new, with_client}`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- `DialogueDispatcherHandlerCx` -> `DialogueWithCx`.
|
- `DialogueDispatcherHandlerCx` -> `DialogueWithCx`.
|
||||||
- `DispatcherHandlerCx` -> `UpdateWithCx`.
|
- `DispatcherHandlerCx` -> `UpdateWithCx`.
|
||||||
- Now provided description of unknown telegram error, by splitting ApiErrorKind at `ApiErrorKind` and `ApiErrorKindKnown` enums ([issue 199](https://github.com/teloxide/teloxide/issues/199)).
|
- Now provided description of unknown telegram error, by splitting ApiErrorKind at `ApiErrorKind` and `ApiErrorKindKnown` enums ([issue 199](https://github.com/teloxide/teloxide/issues/199)).
|
||||||
|
@ -353,24 +367,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Replace all `mime_type: String` with `MimeWrapper`.
|
- Replace all `mime_type: String` with `MimeWrapper`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Now methods which can send file to Telegram returns `tokio::io::Result<T>`. Early its could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)).
|
- Now methods which can send file to Telegram returns `tokio::io::Result<T>`. Early its could panic ([issue 216](https://github.com/teloxide/teloxide/issues/216)).
|
||||||
- If a bot wasn't triggered for several days, it stops responding ([issue 223](https://github.com/teloxide/teloxide/issues/223)).
|
- If a bot wasn't triggered for several days, it stops responding ([issue 223](https://github.com/teloxide/teloxide/issues/223)).
|
||||||
|
|
||||||
## 0.2.0 - 2020-02-25
|
## 0.2.0 - 2020-02-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- The functionality to parse commands only with a correct bot's name (breaks backwards compatibility) ([Issue 168](https://github.com/teloxide/teloxide/issues/168)).
|
- The functionality to parse commands only with a correct bot's name (breaks backwards compatibility) ([Issue 168](https://github.com/teloxide/teloxide/issues/168)).
|
||||||
- This `CHANGELOG.md`.
|
- This `CHANGELOG.md`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix parsing a pinned message ([Issue 167](https://github.com/teloxide/teloxide/issues/167)).
|
- Fix parsing a pinned message ([Issue 167](https://github.com/teloxide/teloxide/issues/167)).
|
||||||
- Replace `LanguageCode` with `String`, because [the official Telegram documentation](https://core.telegram.org/bots/api#getchat) doesn't specify a concrete version of IETF language tag.
|
- Replace `LanguageCode` with `String`, because [the official Telegram documentation](https://core.telegram.org/bots/api#getchat) doesn't specify a concrete version of IETF language tag.
|
||||||
- Problems with the `poll_type` field ([Issue 178](https://github.com/teloxide/teloxide/issues/178)).
|
- Problems with the `poll_type` field ([Issue 178](https://github.com/teloxide/teloxide/issues/178)).
|
||||||
- Make `polling_default` actually a long polling update listener ([PR 182](https://github.com/teloxide/teloxide/pull/182)).
|
- Make `polling_default` actually a long polling update listener ([PR 182](https://github.com/teloxide/teloxide/pull/182)).
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- [either](https://crates.io/crates/either) from the dependencies in `Cargo.toml`.
|
- [either](https://crates.io/crates/either) from the dependencies in `Cargo.toml`.
|
||||||
- `teloxide-macros` migrated into [the separate repository](https://github.com/teloxide/teloxide-macros) to easier releases and testing.
|
- `teloxide-macros` migrated into [the separate repository](https://github.com/teloxide/teloxide-macros) to easier releases and testing.
|
||||||
|
|
||||||
## 0.1.0 - 2020-02-19
|
## 0.1.0 - 2020-02-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- This project.
|
- This project.
|
||||||
|
|
|
@ -211,6 +211,7 @@ where
|
||||||
/// - `Upd`
|
/// - `Upd`
|
||||||
///
|
///
|
||||||
/// [`HandlerExt::enter_dialogue`]: super::HandlerExt::enter_dialogue
|
/// [`HandlerExt::enter_dialogue`]: super::HandlerExt::enter_dialogue
|
||||||
|
#[must_use]
|
||||||
pub fn enter<Upd, S, D, Output>() -> Handler<'static, DependencyMap, Output, DpHandlerDescription>
|
pub fn enter<Upd, S, D, Output>() -> Handler<'static, DependencyMap, Output, DpHandlerDescription>
|
||||||
where
|
where
|
||||||
S: Storage<D> + ?Sized + Send + Sync + 'static,
|
S: Storage<D> + ?Sized + Send + Sync + 'static,
|
||||||
|
|
|
@ -82,6 +82,7 @@ where
|
||||||
///
|
///
|
||||||
/// - [`crate::types::Message`]
|
/// - [`crate::types::Message`]
|
||||||
/// - [`crate::types::Me`]
|
/// - [`crate::types::Me`]
|
||||||
|
#[must_use]
|
||||||
pub fn filter_command<C, Output>() -> Handler<'static, DependencyMap, Output, DpHandlerDescription>
|
pub fn filter_command<C, Output>() -> Handler<'static, DependencyMap, Output, DpHandlerDescription>
|
||||||
where
|
where
|
||||||
C: BotCommands + Send + Sync + 'static,
|
C: BotCommands + Send + Sync + 'static,
|
||||||
|
|
|
@ -235,6 +235,7 @@ pub trait BotCommands: Sized {
|
||||||
/// Returns `PhantomData<Self>` that is used as a param of [`commands_repl`]
|
/// Returns `PhantomData<Self>` that is used as a param of [`commands_repl`]
|
||||||
///
|
///
|
||||||
/// [`commands_repl`]: (crate::repls2::commands_repl)
|
/// [`commands_repl`]: (crate::repls2::commands_repl)
|
||||||
|
#[must_use]
|
||||||
fn ty() -> PhantomData<Self> {
|
fn ty() -> PhantomData<Self> {
|
||||||
PhantomData
|
PhantomData
|
||||||
}
|
}
|
||||||
|
@ -296,11 +297,13 @@ pub struct CommandDescription<'a> {
|
||||||
|
|
||||||
impl<'a> CommandDescriptions<'a> {
|
impl<'a> CommandDescriptions<'a> {
|
||||||
/// Creates new [`CommandDescriptions`] from a list of command descriptions.
|
/// Creates new [`CommandDescriptions`] from a list of command descriptions.
|
||||||
|
#[must_use]
|
||||||
pub fn new(descriptions: &'a [CommandDescription<'a>]) -> Self {
|
pub fn new(descriptions: &'a [CommandDescription<'a>]) -> Self {
|
||||||
Self { global_description: None, descriptions, bot_username: None }
|
Self { global_description: None, descriptions, bot_username: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the global description of these commands.
|
/// Sets the global description of these commands.
|
||||||
|
#[must_use]
|
||||||
pub fn global_description(self, global_description: &'a str) -> Self {
|
pub fn global_description(self, global_description: &'a str) -> Self {
|
||||||
Self { global_description: Some(global_description), ..self }
|
Self { global_description: Some(global_description), ..self }
|
||||||
}
|
}
|
||||||
|
@ -328,6 +331,7 @@ impl<'a> CommandDescriptions<'a> {
|
||||||
/// message"
|
/// message"
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
|
#[must_use]
|
||||||
pub fn username(self, bot_username: &'a str) -> Self {
|
pub fn username(self, bot_username: &'a str) -> Self {
|
||||||
Self { bot_username: Some(bot_username), ..self }
|
Self { bot_username: Some(bot_username), ..self }
|
||||||
}
|
}
|
||||||
|
@ -338,6 +342,7 @@ impl<'a> CommandDescriptions<'a> {
|
||||||
/// method to get the username.
|
/// method to get the username.
|
||||||
///
|
///
|
||||||
/// [`username`]: self::CommandDescriptions::username
|
/// [`username`]: self::CommandDescriptions::username
|
||||||
|
#[must_use]
|
||||||
pub fn username_from_me(self, me: &'a Me) -> CommandDescriptions<'a> {
|
pub fn username_from_me(self, me: &'a Me) -> CommandDescriptions<'a> {
|
||||||
self.username(me.user.username.as_deref().expect("Bots must have usernames"))
|
self.username(me.user.username.as_deref().expect("Bots must have usernames"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue