Commit graph

1632 commits

Author SHA1 Message Date
Maybe Waffle
63a7b02c68 Update dptree (again) 2022-04-15 14:19:46 +04:00
Maybe Waffle
c93022028f Log allowed updates
This will be useful for debugging
2022-04-15 13:04:17 +04:00
Maybe Waffle
dbe45fb49f Update dptree
Use the new naming of things for handler descriptions :)
2022-04-15 13:04:14 +04:00
Maybe Waffle
4db52436f3 [WIP] implement allowed updates in dispatcher 2022-04-15 12:58:52 +04:00
Maybe Waffle
f48c4f7886 Allow changing update distribution function 2022-04-13 16:42:47 +04:00
Maybe Waffle
adccdbae1c move some clones() around 2022-04-13 16:18:04 +04:00
Maybe Waffle
c9a6b77434 Make worker queue size in dp configurable 2022-04-13 16:17:06 +04:00
Maybe Waffle
2aa59d760a Update teloxide-core 0.4.5 -> 0.5.0 2022-04-13 15:58:29 +04:00
Hirrolot
71c647b2c9 Fix .for_each on self.workers 2022-04-13 16:18:02 +06:00
Hirrolot
b2ad297029 Fix formatting 2022-04-13 16:11:47 +06:00
Hirrolot
2e8ed1fa3c
Remove redundant Arc::clone
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2022-04-13 16:10:41 +06:00
Hirrolot
556068fdb1
Wait for workers concurrently
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2022-04-13 16:09:00 +06:00
Hirrolot
579d5a7b7c Wait for workers by .awaiting join handles 2022-04-13 14:05:46 +06:00
Hirrolot
6a83fa5604 Remove redundant async move blocks 2022-04-13 13:40:27 +06:00
Hirrolot
e4459c408d Remove the redundant Box in DefaultHandler 2022-04-13 13:38:05 +06:00
Hirrolot
c2bc945d27 Add some helpful comments 2022-04-13 12:11:02 +06:00
Hirrolot
d6521662b4 Switch worker and default worker impls 2022-04-13 12:07:32 +06:00
Hirrolot
7e34d7ea47 Implement concurrent update handling 2022-04-13 02:45:02 +06:00
Hirrolot
5e21c4d881
Merge pull request #582 from teloxide/deprecate-dispatch-by
Deprecate `HandlerFactory` and `HandlerExt::dispatch_by`
2022-04-10 22:53:37 +06:00
Hirrolot
50c7cfe9d2 Fix dispatcher's graceful shutdown 2022-04-09 02:33:52 +06:00
Hirrolot
ffcdba0e1d Deprecate HandlerFactory and HandlerExt::dispatch_by 2022-04-08 00:18:13 +06:00
Hirrolot
f3b4769bc5 Mark Dialogue::{new, chat_id} as #[must_use] 2022-04-08 00:03:27 +06:00
Hirrolot
c52325b788 Implement Dialogue::chat_id 2022-04-07 18:35:52 +06:00
Waffle Maybe
7abbd2dc09
Merge pull request #554 from teloxide/webhooks
Built-in webhook support
2022-04-07 16:31:26 +04:00
Maybe Waffle
bb7a4729c0 Remove the need for CacheMe in dispatcher 2022-04-05 17:19:10 +04:00
Maybe Waffle
f83ff59709 Fix issues caused by the rebase 2022-04-05 16:42:52 +04:00
Maybe Waffle
0bddb1d927 Update changelog 2022-04-05 16:37:22 +04:00
Maybe Waffle
62052a822a Remove unnecessary bounds
`UpdateListener::StopToken` is required to be `Send` anyway
2022-04-05 16:36:31 +04:00
Maybe Waffle
cf5cbe5a82 Add a workaround to stop webhook listener even when server is still run 2022-04-05 16:36:31 +04:00
Maybe Waffle
cca08ae43c Remove Option<> from webhooks::Options::drop_pending_updates 2022-04-05 16:36:31 +04:00
Maybe Waffle
7e44ab8c11 Add max_connections to the webhooks::Options 2022-04-05 16:36:31 +04:00
Maybe Waffle
4abafbcacc Write documentation for webhooks 2022-04-05 16:36:31 +04:00
Maybe Waffle
2bdfcc9ca6 Move axum webhook impl into a sub-mod 2022-04-05 16:36:31 +04:00
Maybe Waffle
d576d829f1 Allow using axum-based webhooks with existing server
Add `webhooks::{axum_to_router, axum_no_setup}` functions that allow for
more granular control over webhooks:
- `axum_to_router` - do not start the server, only setup webhook and
  return the components
- `axum_no_setup` same as `axum_to_touter` but also do not setup webhook

Also fix `StopToken` sendness.
2022-04-05 16:32:09 +04:00
Maybe Waffle
b86b2f67f3 Add built-in support for webhooks
This commit adds built-in support for webhooks based on the `axum`
framework under a new "webhooks-axum" feature.

API: `update_listeners::webhooks` module with `Options` (a common struct
that stores all webhook related settings) and `axum` (function that
implements webhook).
2022-04-05 16:32:06 +04:00
Hirrolot
d3f1cbfbb2 Clarify the docs of teloxide::handler! 2022-04-03 01:38:25 +06:00
Hirrolot
618be35803 Fix trailing comma issues in teloxide::handler! 2022-04-03 01:11:17 +06:00
Hirrolot
45e7a4274c dptree:: => $crate::dptree:: 2022-04-02 22:26:22 +06:00
Hirrolot
7c523d2b4b $($variant:ident)::* => $($variant:ident)::+ 2022-04-02 22:25:27 +06:00
Hirrolot
b27e7582d3 #[cfg(all(feature = "ctrlc_handler"))] => #[cfg(feature = "ctrlc_handler")] again 2022-04-02 22:23:48 +06:00
Hirrolot
9bb2a85aba Merge branch 'dev' into teloxide-handler 2022-04-02 21:32:59 +06:00
Hirrolot
2f5ce528df Fix the repl_is_send test 2022-04-02 21:03:54 +06:00
Hirrolot
968c988f7f Fix the lost stuff 2022-04-02 20:54:33 +06:00
Hirrolot
18651a8253 Some REPLs twiddling 2022-03-29 02:10:19 +06:00
Hirrolot
4af85f3d5b Remove the dependency requirements notice for commands_repl 2022-03-29 02:03:35 +06:00
Hirrolot
fa5d1f738b Remove support for the old dispatching 2022-03-29 01:55:09 +06:00
Maybe Waffle
ed40e2ad3b fix clippy 2022-03-27 22:11:17 +04:00
Maybe Waffle
6922128cb6 Fix some places with remaining BotCommand (w/o s) 2022-03-27 22:11:17 +04:00
Maybe Waffle
91bea5be5e Apply suggestions from the review
- remove `username_from_bot`
- add `username_from_me`
2022-03-27 22:11:17 +04:00
Maybe Waffle
484d1ccd83 Fixup documentation 2022-03-27 22:10:50 +04:00
Maybe Waffle
86cc3d782f Add CommandDescription[s]
Add two new types - `CommandDescription` and `CommandDescriptions`, make
`BotCommands` return the latter.
2022-03-27 22:10:50 +04:00
Maybe Waffle
b3b8073a12 Rename BotCommand -> BotCommands (the trait)
This removes the ambiguity with `types::BotCommand` and also the new
name just makes more sense, since this trait is usually implemented for
enums that can be many different commands and not a single one.

Note: this requires changes in the `teloxide-macro` crate.
2022-03-27 22:10:50 +04:00
Maybe Waffle
8116059ba3 Document BotCommand methods 2022-03-27 22:10:50 +04:00
Maybe Waffle
ceb2415351 Require that UpdateListener::StopToken is Send 2022-03-27 13:29:17 +04:00
Hirrolot
9cd4bb11b0 Implement teloxide::handler! 2022-03-26 14:56:53 +06:00
Hirrolot
f5653c747d Remove support for the old dispatching 2022-03-24 17:25:42 +06:00
Hirrolot
85a04553a5 Document new command renaming rules 2022-03-23 08:03:15 +06:00
Waffle Maybe
a4c147538b
Merge pull request #559 from teloxide/deprecate_enable_logging
Deprecate `enable_logging!` in favour of configuring logging yourself
2022-03-21 21:12:04 +04:00
Hirrolot
de2974f052 Correct open issue suggestion (dispatching2) 2022-03-21 22:10:45 +06:00
Hirrolot
43a9b2d327 Merge branch 'dev' into correct-open-issue-suggestion 2022-03-21 22:09:52 +06:00
Maybe Waffle
22e5165f89 Remove mentions of enable_logging! from documentation/readme 2022-03-21 19:42:55 +04:00
Hirrolot
1f95c1d2b3 Don't warn abount unhandled updates in repls2 2022-03-21 21:11:46 +06:00
Maybe Waffle
dbc7633fdb Deprecate enable_logging! in favour of configuring logging yourself 2022-03-21 18:55:34 +04:00
Hirrolot
81fbb1769c
Merge pull request #558 from teloxide/log-dispatcher-error
Log `UpdateKind::Error` in `dispatching2`
2022-03-21 07:48:38 -07:00
Hirrolot
91f8eb6acc Log UpdateKind::Error in dispatching2 2022-03-21 20:40:04 +06:00
Hirrolot
be143a3f6e Move ErasedStorage upper 2022-03-21 20:18:36 +06:00
Hirrolot
cf8c1b78b7 Rewrite examples/db_remember.rs to use ErasedStorage 2022-03-21 20:06:32 +06:00
Hirrolot
0b6e7acf9f Favour a default function instead of StorageExt 2022-03-21 18:09:36 +06:00
Hirrolot
c6f0cd9404 Implement ErasedStorage 2022-03-20 09:06:21 +06:00
Waffle Maybe
9d9323648d
Correct open issue suggestion 2022-03-17 22:44:45 +04:00
TheAwiteb
b62d85f2b6
Fix parse_command_with_prefix case sensitive 2022-03-14 17:49:45 +03:00
Maybe Waffle
31ff3a468d Fix compilation with non-default features 2022-03-08 12:20:01 +04:00
Maybe Waffle
ccd87a6ed3 Remove doc(cfg) annotations in favour of feature(doc_auto_cfg) 2022-02-10 16:39:21 +03:00
Hirrolot
24d5c38670 Fix the broken URL 2022-02-08 04:09:08 +06:00
Hirrolot
3ab5763afb Add test_tokio_spawn 2022-02-08 03:54:30 +06:00
Hirrolot
ba277991c9 Make the default and error handlers Send + Sync 2022-02-07 15:53:52 +06:00
Maybe Waffle
24c8035b3c Refactor ShutdownToken 2022-02-04 23:52:52 +03:00
Hirrolot
42e1cd2cd1 Update an example in src/dispatching2/mod.rs 2022-02-05 02:43:12 +06:00
Hirrolot
b4aa3a4504 Move storage back to dispatching 2022-02-05 02:37:01 +06:00
Hirrolot
5909e48e11 Deprecate the old dispatching system 2022-02-05 02:33:03 +06:00
Hirrolot
07b844db99 Add BotCommand::bot_commands 2022-02-05 02:18:47 +06:00
Hirrolot
735e6a41f2 Replace CARGO_PKG_NAME with CARGO_CRATE_NAME in logging 2022-02-05 01:07:28 +06:00
Hirrolot
c2c9620b48 Remove redundant examples from src/logging.rs 2022-02-05 01:01:24 +06:00
Hirrolot
08380790b8 Fix the docs of HandlerFactory 2022-02-05 00:32:12 +06:00
Hirrolot
aade493391 Update the docs of dialogue/mod.rs 2022-02-05 00:26:40 +06:00
Hirrolot
539c53abde Log errors in HandlerExt::enter_dialogue 2022-02-05 00:25:18 +06:00
Hirrolot
67901fa53b Update dptree 2022-02-05 00:02:22 +06:00
Hirrolot
bd73d79e80 Reuse dispatching::dialogue::storage 2022-02-04 22:54:12 +06:00
Hirrolot
a59b3a7957 Make default_handler a closure 2022-02-04 22:32:06 +06:00
Hirrolot
123ac1ec67 Make UpdateFilterExt and MessageFilterExt sealed 2022-02-04 22:01:50 +06:00
Hirrolot
b66beef534 Explain handler params in examples/dialogue.rs 2022-02-04 20:21:16 +06:00
Hirrolot
9efa2f6cbd DispatcherBuilder::new => Dispatcher::builder 2022-02-04 20:09:53 +06:00
Hirrolot
e5330cdec2 HandlerExt::add_dialogue => HandlerExt::enter_dialogue 2022-02-04 20:00:21 +06:00
Hirrolot
8eb8e3c720 Move DialogueHandlerExt::add_dialogue to HandlerExt 2022-02-04 19:53:15 +06:00
Hirrolot
0000839144 HandlerExt::add_command => HandlerExt::filter_command 2022-02-04 19:46:34 +06:00
Hirrolot
5a00e970e4 .chat_id() => .chat.id 2022-02-04 19:45:35 +06:00
Hirrolot
ec9f701cf7 Revert ".chat_id() => .chat_id"
This reverts commit 26a28b1918.
2022-02-04 19:44:04 +06:00
Hirrolot
26a28b1918 .chat_id() => .chat_id 2022-02-04 19:38:06 +06:00
Hirrolot
879560f34a Fix the fixes 2022-02-04 19:09:32 +06:00
Hirrolot
9306f6d484
Update src/dispatching2/dispatcher.rs
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2022-02-04 16:43:52 +06:00
Hirrolot
242bfef885 Fix merge conflicts 2022-02-03 20:39:32 +06:00
Hirrolot
dedb1c85e1 Add high-level documentation 2022-02-03 20:27:45 +06:00
Hirrolot
d4fbaa74c4 Some tiny documentation tweaks 2022-02-03 16:38:54 +06:00
Hirrolot
d89eeb5847 Make setup_ctrlc_handler return &mut Self 2022-02-03 12:48:02 +06:00
Hirrolot
45293e3168 Fix dialogue examples 2022-02-03 02:36:36 +06:00
Hirrolot
60df0a5cf8 Refactor Dialogue
Remove useless stuff, some cleanup, u know.
2022-02-02 15:25:23 +06:00
Hirrolot
d25efa9e14 Document UpdateHandler, DefaultHandler 2022-02-02 05:00:45 +06:00
Hirrolot
5101786d0b requester => bot 2022-02-02 04:55:12 +06:00
Hirrolot
21eb048ca2 Decouple Dispatcher from DispatcherBuilder 2022-02-02 04:51:36 +06:00
Hirrolot
e92eef4a7c Document some stuff 2022-01-31 19:23:47 +06:00
Hirrolot
2058395d54 Add Me into the dependencies 2022-01-28 20:52:01 +06:00
Hirrolot
58311ef608 Add Update & UpdateFilterExt to prelude2 2022-01-26 15:51:43 +06:00
Hirrolot
b1fac57c94
Merge pull request #500 from teloxide/fix_stop_token_sendness
Fix `polling`'s `StopToken` not being `Send`
2022-01-26 12:34:32 +06:00
Maybe Waffle
e83688d4d3 Add toolchain file and fix formatting 2022-01-25 21:07:30 +03:00
Maybe Waffle
ea5eb16276 Clarify StatefulListener docs a little 2022-01-25 20:38:59 +03:00
Maybe Waffle
755ec44aea Cleanup update_listeners docs 2022-01-25 20:25:19 +03:00
Hirrolot
cd51bba180 Refactor Dispatcher 2022-01-24 13:20:13 +06:00
Hirrolot
7d6c374828 Accept the handler as a parameter in Dispatcher::new 2022-01-23 20:58:55 +06:00
Hirrolot
ad88db96b6 Add UpdateFilterExt 2022-01-23 20:38:12 +06:00
Hirrolot
01c43dd360 Refactor MessageFilterExt 2022-01-23 20:15:27 +06:00
Maybe Waffle
a7182962f7 Fix polling's StopToken not being Send 2022-01-18 21:01:47 +03:00
Maybe Waffle
993e6e53aa Do not retry get_updates infinitely while stopping polling listener 2022-01-17 14:42:49 +03:00
Hirrolot
cc0e21c9f8 Remove Dispatcher::without_error_handler 2022-01-16 19:51:36 +06:00
Hirrolot
bacea51adc Expose DefaultHandler, UpdateHandler out of dispatcher.rs 2022-01-16 19:50:39 +06:00
Hirrolot
2ad4e9a9f7 Define Dispatcher handlers via a macro 2022-01-16 18:26:37 +06:00
p0lunin
1be9dd9a48 import MessageFilterExt in the prelude2.rs 2022-01-12 15:44:31 +02:00
p0lunin
3042dcada5 add Dispatcher::error_handler 2022-01-12 14:07:30 +02:00
p0lunin
bbd8f4d5ec add MessageFilterExt 2022-01-12 14:07:18 +02:00
p0lunin
5fb673a87f fix bug with callback_queries_handler 2022-01-12 12:36:42 +02:00
Maybe Waffle
d5392fddab Update teloxide-core yet again 2022-01-12 12:50:35 +03:00
p0lunin
7615fc1392 fix clippy errors 2022-01-06 15:12:57 +02:00
p0lunin
d7386a7dc1 remove old_dispatching feature, add prelude2 and repls2 modules 2022-01-06 14:50:59 +02:00
p0lunin
a8098350fc Merge branch 'dev' into dispatching2
# Conflicts:
#	Cargo.toml
#	examples/dialogue_bot/Cargo.toml
#	examples/inline_bot/src/main.rs
#	src/dispatching/mod.rs
#	src/lib.rs
2022-01-06 14:25:01 +02:00
p0lunin
dac969250d update rest of handlers in the Dispatcher 2022-01-05 20:33:48 +02:00
p0lunin
e2891d6d00 remove #[out()] attribute 2021-12-29 14:21:37 +02:00
p0lunin
72dfef4963 added DialogueState macro 2021-12-29 13:33:51 +02:00
p0lunin
6c0f1b9fc4 Added handler_factory.rs 2021-12-28 18:24:56 +02:00
Maybe Waffle
edecf5975f Update teloxide-core to the latest git version 2021-12-28 17:31:33 +03:00
Hirrolot
b253b7eec2 Don't define async fn run()
rustc now emits enough good compiler error messages for procedural macros such as `#[tokio::main]`.
2021-12-27 21:13:46 +06:00
p0lunin
b10288f751 remove unused imports 2021-12-26 20:06:21 +02:00
p0lunin
4452631fcc fix repls 2021-12-26 19:59:13 +02:00
p0lunin
a644d0b6d2 added handler_ext.rs, updated dptree version 2021-12-26 16:55:24 +02:00
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