From ba277991c9d0dcecbb4f06b59e0b82a9d48f8983 Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Mon, 7 Feb 2022 15:53:52 +0600
Subject: [PATCH 1/6] Make the default and error handlers `Send + Sync`

---
 src/dispatching2/dispatcher.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/dispatching2/dispatcher.rs b/src/dispatching2/dispatcher.rs
index 5e885101..b5268a9a 100644
--- a/src/dispatching2/dispatcher.rs
+++ b/src/dispatching2/dispatcher.rs
@@ -22,7 +22,7 @@ pub struct DispatcherBuilder<R, Err> {
     dependencies: DependencyMap,
     handler: UpdateHandler<Err>,
     default_handler: DefaultHandler,
-    error_handler: Arc<dyn ErrorHandler<Err>>,
+    error_handler: Arc<dyn ErrorHandler<Err> + Send + Sync>,
 }
 
 impl<R, Err> DispatcherBuilder<R, Err>
@@ -36,7 +36,7 @@ where
     #[must_use]
     pub fn default_handler<H, Fut>(self, handler: H) -> Self
     where
-        H: Fn(Arc<Update>) -> Fut + 'static,
+        H: Fn(Arc<Update>) -> Fut + Send + Sync + 'static,
         Fut: Future<Output = ()> + Send + 'static,
     {
         let handler = Arc::new(handler);
@@ -54,7 +54,7 @@ where
     ///
     /// By default, it is [`LoggingErrorHandler`].
     #[must_use]
-    pub fn error_handler(self, handler: Arc<dyn ErrorHandler<Err>>) -> Self {
+    pub fn error_handler(self, handler: Arc<dyn ErrorHandler<Err> + Send + Sync>) -> Self {
         Self { error_handler: handler, ..self }
     }
 
@@ -90,7 +90,7 @@ pub struct Dispatcher<R, Err> {
 
     handler: UpdateHandler<Err>,
     default_handler: DefaultHandler,
-    error_handler: Arc<dyn ErrorHandler<Err>>,
+    error_handler: Arc<dyn ErrorHandler<Err> + Send + Sync>,
     // TODO: respect allowed_udpates
     allowed_updates: HashSet<AllowedUpdate>,
 
@@ -103,7 +103,7 @@ pub struct Dispatcher<R, Err> {
 /// A handler that processes updates from Telegram.
 pub type UpdateHandler<Err> = dptree::Handler<'static, DependencyMap, Result<(), Err>>;
 
-type DefaultHandler = Box<dyn Fn(Arc<Update>) -> BoxFuture<'static, ()>>;
+type DefaultHandler = Box<dyn Fn(Arc<Update>) -> BoxFuture<'static, ()> + Send + Sync>;
 
 impl<R, Err> Dispatcher<R, Err>
 where

From 62da2cacb843bf8c39b5242e6ef2ee7d9d445c2c Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Mon, 7 Feb 2022 15:58:34 +0600
Subject: [PATCH 2/6] Update the changelog

---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60f13485..e47ff9cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## unreleased
 
+### Changed
+
+- Make `DispatcherBuilder::{default_handler, error_handler}` accept a handler that implements `Send + Sync` ([PR 517](https://github.com/teloxide/teloxide/pull/517)).
+
 ## 0.6.1 - 2022-02-06
 
 ### Fixed

From 3ab5763afbd6cd4fb450e35bc9511cbd2adeb182 Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Tue, 8 Feb 2022 03:54:30 +0600
Subject: [PATCH 3/6] Add `test_tokio_spawn`

---
 src/dispatching2/dispatcher.rs | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/dispatching2/dispatcher.rs b/src/dispatching2/dispatcher.rs
index b5268a9a..369fd1a2 100644
--- a/src/dispatching2/dispatcher.rs
+++ b/src/dispatching2/dispatcher.rs
@@ -272,3 +272,27 @@ where
         self.state.clone()
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use std::convert::Infallible;
+
+    use teloxide_core::Bot;
+
+    use super::*;
+
+    #[tokio::test]
+    async fn test_tokio_spawn() {
+        tokio::spawn(async {
+            // Just check that this code compiles.
+            if false {
+                Dispatcher::<_, Infallible>::builder(Bot::new(""), dptree::entry())
+                    .build()
+                    .dispatch()
+                    .await;
+            }
+        })
+        .await
+        .unwrap();
+    }
+}

From 24d5c38670528a689c2f6b9ca3e6e21ba7b3827c Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Tue, 8 Feb 2022 03:58:59 +0600
Subject: [PATCH 4/6] Fix the broken URL

---
 src/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib.rs b/src/lib.rs
index 8c3ea617..0902226c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,7 +4,7 @@
 //!
 //! For a high-level overview, see [our GitHub repository](https://github.com/teloxide/teloxide).
 //!
-//! ([Full](https://github.com/teloxide/teloxide/blob/master/examples/dices_bot/src/main.rs))
+//! ([Full](https://github.com/teloxide/teloxide/blob/master/examples/dices.rs))
 //! ```no_run
 //! use teloxide::prelude2::*;
 //!

From 30d37741e41e1e70986a2c172119d45d55ce6aa4 Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Wed, 9 Feb 2022 08:36:25 +0600
Subject: [PATCH 5/6] Release v0.7.0

---
 CHANGELOG.md | 2 ++
 Cargo.toml   | 2 +-
 README.md    | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e47ff9cf..6e74c334 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## unreleased
 
+## 0.7.0 - 2022-02-09
+
 ### Changed
 
 - Make `DispatcherBuilder::{default_handler, error_handler}` accept a handler that implements `Send + Sync` ([PR 517](https://github.com/teloxide/teloxide/pull/517)).
diff --git a/Cargo.toml b/Cargo.toml
index 8bb19f13..8e79ded9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "teloxide"
-version = "0.6.1"
+version = "0.7.0"
 edition = "2018"
 description = "An elegant Telegram bots framework for Rust"
 repository = "https://github.com/teloxide/teloxide"
diff --git a/README.md b/README.md
index 4f799473..e61ac24c 100644
--- a/README.md
+++ b/README.md
@@ -73,7 +73,7 @@ $ rustup override set nightly
  5. Run `cargo new my_bot`, enter the directory and put these lines into your `Cargo.toml`:
 ```toml
 [dependencies]
-teloxide = { version = "0.6", features = ["macros", "auto-send"] }
+teloxide = { version = "0.7", features = ["macros", "auto-send"] }
 log = "0.4"
 pretty_env_logger = "0.4.0"
 tokio = { version =  "1.8", features = ["rt-multi-thread", "macros"] }

From f923114d204f29d8c19bf5aeaecfbfdee620d6d6 Mon Sep 17 00:00:00 2001
From: Hirrolot <hirrolot@gmail.com>
Date: Wed, 9 Feb 2022 17:06:17 +0600
Subject: [PATCH 6/6] Fix the changelog

---
 CHANGELOG.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e74c334..80511445 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,9 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## 0.7.0 - 2022-02-09
 
-### Changed
+### Fixed
 
-- Make `DispatcherBuilder::{default_handler, error_handler}` accept a handler that implements `Send + Sync` ([PR 517](https://github.com/teloxide/teloxide/pull/517)).
+- `Dispatcher` wasn't `Send`. Make `DispatcherBuilder::{default_handler, error_handler}` accept a handler that implements `Send + Sync` ([PR 517](https://github.com/teloxide/teloxide/pull/517)).
 
 ## 0.6.1 - 2022-02-06