Commit graph

1540 commits

Author SHA1 Message Date
p0lunin
6959d1c928 added dialogues + updated sqlite_remember_bot example. 2021-12-15 13:46:32 +02:00
p0lunin
3f1d1360c6 fmt 2021-12-11 13:11:44 +02:00
p0lunin
635c18142a 1. Bump futures to 0.3.15 version (Abortable::is_aborted()).
2. Fix simple_commands_bot example.
2021-12-11 13:11:25 +02:00
p0lunin
4752b22c43 1. Change feature dispatching2 -> old_dispatching.
2. Added command repls.
3. Added function BotCommand::ty() due to new restrictions in the command repls.
2021-12-11 12:46:44 +02:00
p0lunin
93ed028e44 added dispatching2 feature, implemented standard repls 2021-11-25 13:44:55 +02:00
p0lunin
14083c8300 Many improvements of Dispatcher, also made many dispatcher::* methods and types pub(crate) for using in dispatching2 module 2021-11-25 12:59:54 +02:00
p0lunin
887b24d27f Initial commit.
1. Added `dptree` dependency.
2. Added `dispatching2` module.
2. Added `Dispatcher` and `Handlers` types, which is similar to `dispatching::Dispatcher` type.
2021-11-13 12:35:56 +02:00
Waffle Maybe
fb238ff656
Merge branch 'dev' into master-to-dev-1 2021-10-25 17:17:42 +03:00
Maybe Waffle
f6c4701932 fix clippy 2021-10-25 15:50:04 +03:00
­
964323fca4
Fix compilation without ctrlc_handler feature
The feature gate is moved to the `dispatching` mod level.
Public exports are also covered by this flag now.
2021-10-25 02:12:11 +03:00
­
a7049c9e7d
Docs: Add missing features description 2021-10-23 01:56:17 +03:00
Maybe Waffle
fc4bb6be14 fix clippy 2021-10-10 15:15:16 +03:00
Waffle
a97050de24 Require that AsUpdateStream::Stream is Send 2021-09-04 14:05:18 +03:00
Waffle
18cfb675bf Fix doc(cfg) annotation 2021-09-04 14:00:43 +03:00
Waffle
a2bfdf850a Suppress clippy false positive 2021-08-19 12:03:35 +03:00
Waffle
b984464a79 Improve log messages when ^C is received with ^C handler setted up
Now they tell the user to not repeatedly press `^C` since only the first
signal actually does anything, all subsequesnt ones are ignored.
2021-07-21 15:53:52 +03:00
Waffle
81775a7217 Show "This is supported on feature="..." only." in socs of reexported teloxide-core items 2021-07-07 20:27:38 +03:00
dracarys18
4c480a1714 Merge github.com:teloxide/teloxide into dev 2021-07-04 09:17:41 +05:30
Waffle
39e0ee094a Ignore buggy nonstandard_macro_braces clippy lint 2021-07-04 00:22:11 +03:00
dracarys18
1f1a3abd6b utils: Change the user_id type to i64
user_id is of type i64 in User struct (bd104a0a08/src/types/user.rs (L10))

Signed-off-by: dracarys18 <karthihegde010@gmail.com>
2021-07-03 17:31:57 +05:30
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
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
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