Comments (1)
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;
}
from teloxide.
Related Issues (20)
- UserId should be i64 -- not u64? HOT 2
- Add support Bot API 6.8
- reply_to_message_id in send message HOT 1
- Unknown error: "Bad Request: message to copy not found"
- Cannot use sqlite due to old version in teloxide HOT 4
- Feature Request: set InputMessageTextContent parse_mode from `DefaultParseMode<Bot>` HOT 1
- `Hide` MetaWord attribute work also as MetaNameValueStr attribute
- `Update::filter_chat_join_request()` does not work HOT 1
- Pass Arc to handler when using Command::repl. HOT 2
- How can i get web app data in my bot? HOT 1
- buttonrequest cannot open web in telegram for android in 10.0.8 version HOT 2
- Incorrect type for `photo_size`, `photo_width` and `photo_height` of send_invoice in schema.ron file HOT 2
- Implement support for TBA 6.5 HOT 2
- Add missing `{Update,Message}::filter_*` functions HOT 5
- Cannot parse an update with boost link HOT 4
- `MessageCommon::from` should be inside `Message` HOT 3
- Figure out how to properly represent `ChatPermissions`
- Incompatibility with Bot API 6.3 HOT 3
- Add `cargo-semver-checks` to CI checks HOT 2
- Timeout without preconnect HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from teloxide.