We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi how can I combine:
// Only iterate through commands in a proper format: rx.commands::<Command, &str>(&bot_name) // Execute all incoming commands concurrently: .for_each_concurrent(None, |(cx, command, _)| async move { answer(cx, command).await.log_on_error().await; }) .await;
with
rx.for_each(|message| async move { message.answer("pong").send().await.log_on_error().await; }) .await;
?
The text was updated successfully, but these errors were encountered:
Nvm I got this using this rather unpretty way:
async fn handle_messages(rx: DispatcherHandlerRx<Message>) { rx.text_messages().for_each(|(cx, text)| async move { let bot_name = env::var("TELEGRAM_BOT_USERNAME") .expect("Expected a Bot username in $TELEGRAM_BOT_USERNAME"); if Command::parse(&(text.clone()), &(bot_name.clone())).is_none() { cx.answer("pong").send().await.log_on_error().await; } else { Command::parse(&(text.clone()), &(bot_name.clone())).map(|(command, _args)| async { answer(cx, command).await.log_on_error().await; }).expect("unable to parse command").await; }; }).await; }
Sorry, something went wrong.
Merge pull request #193 from teloxide/telergam
c250a9b
Fix a typo in documentation
No branches or pull requests
Hi how can I combine:
with
?
The text was updated successfully, but these errors were encountered: