Skip to content

Commit

Permalink
Uprade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Desiders committed Jan 31, 2024
1 parent a28d6c6 commit 4e72ecd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[workspace]
members = ["telers", "telers-*", "examples/*"]
default-members = ["telers", "telers-*"]
exclude = []
resolver = "2"
2 changes: 1 addition & 1 deletion examples/axum_and_echo_bot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ telers = { path = "../../telers", features = ["default"] }
tokio = { version = "1.28", features = ["macros", "rt-multi-thread"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
axum = "0.6"
axum = "0.7"
17 changes: 12 additions & 5 deletions examples/axum_and_echo_bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
//! RUST_LOG={log_level} BOT_TOKEN={your_bot_token} cargo run --package axum_and_echo_bot
//! ```
use axum::{routing::get, Router as AxumRouter, Server};
use axum::{routing, Router as AxumRouter};
use telers::{
enums::UpdateType,
event::{telegram::HandlerResult, EventReturn, ToServiceProvider as _},
methods::CopyMessage,
types::Message,
Bot, Dispatcher, Router as TelersRouter,
};
use tokio::net::TcpListener;
use tracing::{event, Level};
use tracing_subscriber::{fmt, layer::SubscriberExt as _, util::SubscriberInitExt as _, EnvFilter};

Expand Down Expand Up @@ -57,11 +58,11 @@ async fn main() {
.unwrap();

let app = AxumRouter::new()
.route("/", get(hello_world_handler))
.route("/", routing::get(hello_world_handler))
.into_make_service();

let server = Server::bind(&"0.0.0.0:3000".parse().unwrap());

// `tokio::spawn` is used to run polling and server in different threads.
// You can also don't use `tokio::spawn` and run them in the same thread.
tokio::join!(
async {
match tokio::spawn(dispatcher.run_polling()).await {
Expand All @@ -78,7 +79,13 @@ async fn main() {
// Check graceful shutdown example of axum server:
// https://github.com/tokio-rs/axum/tree/main/examples/graceful-shutdown
// Telers provides graceful shutdown out of the box, so you don't need to do anything special.
match tokio::spawn(server.serve(app)).await {
match tokio::spawn(async {
let listener = TcpListener::bind("0.0.0.0:3000").await?;

axum::serve(listener, app).await
})
.await
{
Ok(Ok(())) => {}
Ok(Err(err)) => {
event!(Level::ERROR, "Error in server: {:?}", err);
Expand Down
6 changes: 3 additions & 3 deletions telers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ tokio-util = { version = "0.7", features = ["codec"] }
reqwest = { version = "0.11", features = ["multipart", "stream"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "3.4"
strum = "0.25"
strum_macros = "0.25"
serde_with = "3.6"
strum = "0.26"
strum_macros = "0.26"
futures = "0.3"
async-trait = "0.1"
once_cell = "1.16"
Expand Down

0 comments on commit 4e72ecd

Please sign in to comment.