Commit graph

2179 commits

Author SHA1 Message Date
dracarys18
6bb18ea40b Add reply shortcuts for every kind of message
Signed-off-by: dracarys18 <karthihegde010@gmail.com>
2021-06-30 17:59:07 +05:30
Hirrolot
01d1c8c95b
Merge pull request #403 from teloxide/hint_allowed_updates
Implement automatic update filtering
2021-06-27 18:56:48 +06:00
Waffle
7859294ff6 Apply suggestion from the review 2021-06-27 15:52:23 +03:00
Waffle
faef0c6ffb Implement automatic update filtering
Add `UpdateListener::hint_allowed_updates` and `StatefulListener::hint_allowed_updates`.

Make `Dispatcher` call `UpdateListener::hint_allowed_updates` when starting dispatching.
2021-06-27 15:07:21 +03:00
Hirrolot
3441ef46c0
Merge pull request #385 from teloxide/graceful_shutdown
Graceful shutdown & co
2021-06-27 16:41:44 +06:00
Hirrolot
c5ac8b5f9c Emit graceful shutdown info in all cases 2021-06-27 16:36:36 +06:00
Hirrolot
a6c480930a Print info about graceful shutdown to users 2021-06-27 15:44:46 +06:00
Hirrolot
afe5a9716b Enhance the docs 2021-06-27 14:57:02 +06:00
Waffle
8796bc11ba Update changelog 2021-06-27 11:04:55 +03:00
Waffle
558e7d5a72 Add IdleShutdownError 2021-06-27 10:50:47 +03:00
Waffle
0347f9e627 Replace ShutdownError with () 2021-06-26 23:21:44 +03:00
Waffle
483e544223 Apply suggestions from the review: rename AtomicShutdownState => DispatcherState, IsntRunning => Idle 2021-06-26 23:04:36 +03:00
Waffle
1795cb22c2 setup ^C handler in repls 2021-06-26 17:19:56 +03:00
Waffle
49848abd61 Doc fixes 2021-06-26 15:33:33 +03:00
Waffle
8e3ef4ab67 Minor Dispatcher cleanup 2021-06-26 15:08:32 +03:00
Waffle
7cfb207b44 Wait for handlers to finish before shutting down dispatcher
This commit makes `Dispatcher::dispatch_with_listener` (and all it's derivatives
like `Dispatcher::dispatch`, `teloxide::repl`) to wait for handlers to finish
berfore shutting down.

This commit also changes self-type for `Dispatcher::dispatch_with_listener` and
`Dispatcher::dispatch` from `&Self` to `&mut Self` (this is required to wait
for handlers to finish).

Since unique reference is now required for listening,`Dispatcher::shutdown`
function is removed.
2021-06-26 14:33:10 +03:00
Waffle
569ef222fc Add dispatcher shutdown token
This commit adds `ShutdownToken` which can be obrained throught
`Dispatcher::shutdown_token` and then later be used to shutdown dispatching.
2021-06-25 17:41:02 +03:00
Waffle
c378d6ef4e Make StatefulListener::new a little more convinient
Remove `timeout_hint` from the `StatefulListener::new` function. This parameter
is confusing and is likely to be set to `None` in most cases.

Add a `StatefulListener::new_with_timeout_hint` parameter which is the same as
the old `StatefulListener::new`.
2021-06-25 17:24:31 +03:00
Waffle
76dee997e0 Fix webhook examples (support graceful shutdown) 2021-06-25 16:57:24 +03:00
Waffle
8785b8263c Fix overflow in dispatch_with_listener 2021-06-25 16:57:24 +03:00
Waffle
f58ae9b9ca Make StatefulListener pub 2021-06-25 16:57:24 +03:00
Waffle
881aa3d6b6 Split update_listeners into multiple modules 2021-06-25 16:57:24 +03:00
Waffle
a162478346 Switch graceful shutdown to cancelation token-like system 2021-06-25 16:57:24 +03:00
Waffle Lapkin
a8306ec3ff Apply suggestions from code review
Co-authored-by: Hirrolot <hirrolot@gmail.com>
2021-06-25 16:57:24 +03:00
Waffle
00093664c7 Remove use of unstable feature (duration_zero)
The feature has been stabilized in 1.53.
2021-06-25 16:57:24 +03:00
Waffle
a5192a9ecb Clippy 2021-06-25 16:57:24 +03:00
Waffle
d745f9bdb1 Remove send! macro 2021-06-25 16:57:24 +03:00
Waffle
f0de55ad55 Add Dispatcher::setup_ctrlc_handler function.
This function sets up `^C` handler which shuts down dispatching.
2021-06-25 16:57:24 +03:00
Waffle
41a95079b2 Add Dispatcher::shutdown function
This function allows to gracefuly shutdown dispatching.
2021-06-25 16:57:24 +03:00
Waffle
eae2bced6d Simplify polling a little bit 2021-06-25 16:57:24 +03:00
Waffle
9f5a222ed7 Add UpdateListener::timeout_hint 2021-06-25 16:57:24 +03:00
Waffle
c288a540b9 Store fetched updates in polling::State
This way updates aren't lost when the stream is dropped.
2021-06-25 16:57:24 +03:00
Waffle
aeca45a579 Refactor UpdateListner trait
Instead of `Stream` super trait we now require `for<'a> AsUpdateStream<'a, E'>`
as a super trait. `AsUpdateStream` in turn provides `as_stream` function which
takes `&mut self` and returns `Self::Stream` (the trait is needed to workaround
lack of GAT).

This patch also adds a `stop` function that allows stopping the listener.

Since `UpdateListner` now isn't `Stream` and required methods, it's blanked
implementation for streams was removed.

`polling` and `polling_default` functions now also require `R: 'static`.
2021-06-25 16:57:24 +03:00
Hirrolot
59e5d385e7
Merge pull request #401 from dracarys18/dev
add community bot: dracary18/grpmr-rs
2021-06-22 13:20:27 +06:00
dracarys18
d97dfa3058 add community bot: dracary18/grpmr-rs
Signed-off-by: dracarys18 <karthihegde010@gmail.com>
2021-06-22 11:37:07 +05:30
Hirrolot
ab6c76650a
Merge pull request #400 from teloxide/remove-lockfree-dep
Replace `lockfree` with `flurry`
2021-06-18 22:21:53 +06:00
Hirrolot
0f857e944b feature = "nightly" => all(docsrs, feature = "nightly") 2021-06-18 22:17:08 +06:00
Hirrolot
6a7ad31fc9 Place the comment above feature(doc_cfg) 2021-06-18 22:07:37 +06:00
Hirrolot
74348b7236 Remove feature(external_doc) completely 2021-06-18 21:44:10 +06:00
Hirrolot
fb0b267b94 Fix the removed feature external_doc 2021-06-18 21:35:54 +06:00
Hirrolot
f4260ed078 Replace lockfree with flurry 2021-06-18 20:53:03 +06:00
Hirrolot
83e1247905
Merge pull request #390 from Askannz/patch-1
README: enable the "macros" feature in the quickstart Cargo.toml
2021-05-29 17:43:08 +06:00
Robin Lange
e3a3c1ed50
README: enable the "macros" feature in the quickstart Cargo.toml
The "commands" example later in the README does not compile without it.
2021-05-29 16:48:00 +10:00
Waffle Lapkin
49a0e54957
Merge pull request #388 from teloxide/more-community-bots
Add more community bots
2021-05-25 07:13:33 +03:00
Hirrolot
86515b13ed
Add more community bots 2021-05-25 09:00:52 +06:00
Hirrolot
051a3ba671
Merge pull request #387 from teloxide/simplify-simple-commands-bot-send
Don't use `.send()` in `examples/simple_commands_bot`
2021-05-20 22:00:03 +06:00
Hirrolot
1d5859507a Remove feature(extended_key_value_attributes) 2021-05-20 21:54:41 +06:00
Hirrolot
c3bcdca549 Don't use .send() in examples/simple_commands_bot 2021-05-20 21:37:53 +06:00
Waffle Lapkin
9d243b50c8
Merge pull request #386 from teloxide/default-tls
Enable TLS by default
2021-05-19 09:47:17 +03:00
Waffle
0eef5b8487 Enable TLS by default
We use HTTPS which doesn't work without TLS implementation.
2021-05-18 18:52:29 +03:00