Skip to content

Instantly share code, notes, and snippets.

@GoldsteinE
Last active February 11, 2020 13:12
Show Gist options
  • Save GoldsteinE/dbee3c535212014b629a855402c08d78 to your computer and use it in GitHub Desktop.
Save GoldsteinE/dbee3c535212014b629a855402c08d78 to your computer and use it in GitHub Desktop.
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:5:1
|
5 | #[tokio::main]
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `HandlerE`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:5:1
|
5 | #[tokio::main]
| ^^^^^^^^^^^^^^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:5:1
|
5 | #[tokio::main]
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `E`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:5:1
|
5 | #[tokio::main]
| ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
use std::env;
use dotenv::dotenv;
use teloxide::prelude::*;
#[tokio::main]
async fn main() {
dotenv().ok();
let token = env::var("BOT_API_TOKEN").unwrap();
Dispatcher::new(Bot::new(token))
.message_handler(&|ctx: DispatcherHandlerCtx<Message>| async move {
ctx.answer("test").send().await?;
Ok(())
})
.dispatch()
.await;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment