Last active
February 11, 2020 13:12
-
-
Save GoldsteinE/dbee3c535212014b629a855402c08d78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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