Commit graph

551 commits

Author SHA1 Message Date
Maybe Waffle
45183d4dcd fix test 2021-11-15 01:47:54 +03:00
Maybe Waffle
8002f98ef7 Add TBA 5.4 types 2021-11-15 01:46:53 +03:00
Maybe Waffle
094211e6a1 Add TBA v5.4 methods and params
(schema update)
2021-11-15 01:46:53 +03:00
Maybe Waffle
9fb6c20f23 Make SendPoll::type_ optional
(fix from schema)
2021-11-15 01:46:53 +03:00
Maybe Waffle
9bcdd37be0 Remove PartialEq, Eq, Hash derives from InputFile
...and tg-method-structs holding it
2021-11-15 01:46:53 +03:00
Maybe Waffle
af54d6db7a Fix conflict between PRs 134 and 135 2021-11-13 20:16:13 +03:00
Hirrolot
461d882bc1
Merge pull request #134 from teloxide/errfactor
Refactor errors
2021-11-13 19:09:22 +06:00
Maybe Waffle
8d1dd8d444 Add ApiError::TooMuchInlineQueryResults 2021-11-09 21:16:56 +03:00
Maybe Waffle
27e1b90c6e Refactor errors 2021-11-08 00:02:17 +03:00
Waffle Maybe
00abf2fd80
Merge pull request #131 from berkus/fix/add-derive-debug
fix: Add missing derive(Debug) on adapters
2021-11-07 13:27:13 +03:00
Berkus Decker
f868152e2f fix: Add missing derive(Debug) on adapters 2021-11-07 12:22:05 +02:00
Waffle Maybe
839181bffd
Merge pull request #127 from teloxide/must_use_requests
Add `#[must_use]` attrs to payload setters, request wrappers and send* methods
2021-10-24 23:10:25 +03:00
Hirrolot
8ee25a616c
Merge pull request #128 from teloxide/inline_methods_fix
Fix `*_inline` methods (release v0.3.4)
2021-10-18 18:04:13 +06:00
Maybe Waffle
bd8bafd03b Fix *_inline methods (release v0.3.4) 2021-10-18 13:47:02 +03:00
Maybe Waffle
73235682a3 Add #[must_use] attrs to payload setters, request wrappers and send* methods 2021-10-15 19:07:41 +03:00
Waffle Maybe
6e6cabb5b7
Merge pull request #126 from teloxide/imply_doc_cfg
Remove explicit `doc(cfg)` as it's now implied
2021-10-11 17:26:29 +03:00
Waffle Maybe
2ceb2c5782
Merge pull request #125 from teloxide/api_error_non_exhaustive
Mark `ApiError` as `non_exhaustive`
2021-10-11 17:26:04 +03:00
Maybe Waffle
62d21d1c58 Remove explicit doc(cfg) as it's now implied 2021-10-11 16:58:15 +03:00
Maybe Waffle
25db4901e2 Mark ApiError as non_exhaustive 2021-10-10 16:40:31 +03:00
Maybe Waffle
037e0eaf41 Add some sticker errors 2021-10-10 16:33:40 +03:00
Maybe Waffle
d3be288eba Add NotEnoughRightsToPostMessages error 2021-10-10 14:59:06 +03:00
Waffle
00b83770a7 Throttle: correct limits for channels
This commits adds `Limits::messages_per_min_channel` field
2021-09-16 02:51:28 +03:00
Waffle
86a478dd1d Throttle: fix limit check
Previously both `messages_per_sec_chat` and `messages_per_min_chat` were
checked against last second message count.
2021-09-16 00:04:01 +03:00
Andrew
602c573b92
Fix type of Poll::open_period field: i32 => u16 2021-09-07 15:35:07 +05:00
Andrew
6d4ad2932c
Fix type of Poll::correct_option_id field: i32 => u8 2021-09-07 15:32:00 +05:00
Waffle
842315150b Add UntilDate enum and use it for {Restricted, Banned}::until_date 2021-09-02 18:14:54 +03:00
Waffle
0e55b41961 Patch BanChatMember::until_date: u64 -> DateTime<Utc> 2021-09-02 17:18:27 +03:00
Hirrolot
3d7ca29681
Merge pull request #115 from teloxide/make_urls_urlier
Use `url::Url` for urls, use `chrono::DateTime<Utc>` for dates in types
2021-08-31 07:50:38 -07:00
Hirrolot
16a3ba3349
Merge pull request #113 from teloxide/dont_reparse_url_on_every_request
Do not re-parse default tba url on every request
2021-08-31 07:50:21 -07:00
Waffle
d3bf4499ea Use url::Url for urls, use chrono::DateTime<Utc> for dates in types 2021-08-31 17:45:20 +03:00
hex0x0000
2c53236af4 Fixed url formatting and a typo
Fixed formatting

Merging suggestion

Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>

Fixed other typos
2021-08-28 14:36:31 +02:00
Waffle
a422f97480 Do not re-parse default tba url on every request 2021-08-28 14:54:40 +03:00
Hirrolot
261be16b47
Merge pull request #106 from teloxide/use_tokio_task_unconstrained
Use `tokio::task::unconstrained` when using `.now_or_never()` to prevent some problems I guess
2021-08-22 01:55:23 -07:00
Waffle
2417b636a6 Add EditedMessageIsTooLong error 2021-08-21 23:59:59 +03:00
Waffle
5349c85404 Fix compilation with nigthly feature
The `min_type_alias_impl_trait` feature was removed in faviour of `type_alias_impl_trait`.
2021-08-03 02:29:26 +03:00
Waffle
0471cb0322 Use tokio::task::unconstrained when using .now_or_never() to prevent some problems I guess
The issue in fixme says to use `tokio::task::unconstrained`.
2021-07-23 20:08:26 +03:00
Waffle
2abd9b17a6 Fix typo in docs 2021-07-16 22:41:50 +03:00
Waffle
4ccedd7f77 suppress clippy 2021-07-12 17:07:20 +03:00
Waffle
1fe4518ee9 Add tools for Bot/Request type erasure 2021-07-12 16:58:51 +03:00
Waffle
33236f79e6 Document trace_adaptor feature 2021-07-11 15:58:09 +03:00
Waffle
9e8819d726 Add Trace bot adaptor 2021-07-10 17:41:20 +03:00
Waffle
5aa622b361 impl HasPayload, Request and Requester for either::Either
This allows to use different adaptors depending on runtime context.
2021-07-08 13:04:40 +03:00
Waffle
23c125775c Remove Self: 'static buound on RequesterExt::throttle 2021-07-07 20:14:27 +03:00
Waffle
e7b44e6bbe Use cfg(dep_docsrs) to allow building docs properly as a dependency 2021-07-07 20:14:25 +03:00
Waffle
df69d07f2b Bump version (0.2.2 => 0.3.0) 2021-07-04 17:36:07 +03:00
Waffle
5ac43d4ac0 Fix type of PhotoSize::{width,height} fields: i32 => u32 2021-07-04 17:36:07 +03:00
Waffle
44c1cfd420 Remove keyboad method (typo, was fixed to keyboard in 0.2.2) 2021-07-04 17:36:07 +03:00
Waffle
e6b66a7383 TBA 5.3: update changelog and supported version 2021-07-04 16:06:06 +03:00
Waffle
120ed97e8c TBA 5.3: Update methods 2021-07-04 16:06:06 +03:00
Waffle
27f5875b42 TBA 5.3: Add BotCommandScope 2021-07-04 16:06:06 +03:00
Waffle
ef84162314 Use DateTime<Utc> for until_date in ChatMember 2021-07-04 16:06:06 +03:00
Waffle
c3a00c687a TBA 5.3: rename chat member statuses: Creator => Owner, Kicked => Banned 2021-07-04 16:06:06 +03:00
Waffle
2c65fea742 TBA 5.3: Add input_field_placeholder to KeyboardMarkup and ForceReply 2021-07-04 14:56:25 +03:00
Hirrolot
52313b740c
Merge pull request #96 from teloxide/throttle_settings
Make `Throttle` settings more extendable
2021-07-04 07:59:56 +06:00
Hirrolot
9e7685e7b4 Merge branch 'master' into throttle_settings 2021-07-04 07:53:09 +06:00
Hirrolot
40c712e1d6 Merge branch 'master' into typed_urls_dates 2021-07-04 07:37:21 +06:00
Waffle
fa980453f3 Ignore buggy nonstandard_macro_braces clippy lint 2021-07-04 00:11:27 +03:00
Waffle
421cf42835 Use url::Url for urls, use chrono::DateTime<Utc> for dates 2021-07-03 23:35:13 +03:00
Waffle
4377abd149 Make Throttle settings more extendable
Add a `#[non_exhaustive]` `Settings` builder struct.
Replace `with_queue_full_fn` and `spawn_with_queue_full_fn` with
`with_settings` and `spawn_with_settings`.

This allows to add more settings in the future without breaking changes.
2021-07-03 22:34:31 +03:00
Waffle
1661f9f955 Throttle: Avoid repeatedly calling queue_full 2021-06-29 21:24:04 +03:00
Waffle
6450d9227d Add Throttle::{with_queue_full_fn, spawn_with_queue_full_fn} 2021-06-29 21:24:04 +03:00
Waffle
07676a7156 Throttle: log when queue is full 2021-06-29 21:24:04 +03:00
Waffle
58cbf45bac Remove QueueStatus 2021-06-29 21:22:42 +03:00
Waffle
34e73748c3 Add a way to get info from/into Thrrotle
This patch adds `Thrrotle::{limits,set_limits,queue_status}` functions and
`QueueStatus` struct allowing to get current status of worker & change
limits of the fly.
2021-06-29 21:22:40 +03:00
Waffle
0dc565211f Add DefaultParseMode::parse_mode 2021-06-29 21:21:47 +03:00
Waffle
656e393779 Fix rt-tys of {get,set}_my_commands methods
Fix return types of `get_my_commands` (`u32` => `True`) and `set_my commands`
(`u32` => `Vec<BotCommand>`).
2021-06-24 20:49:26 +03:00
liushuyu
414ce2c3a6
telegram_response: fix issue with handling ...
... `retry_after` and `migrate_to_chat_id`
2021-06-19 03:16:30 -06:00
Waffle
c1eca613d5 Fix Clippy: remove useless (immediately implicitly dereferenced) refs 2021-06-09 11:34:40 +03:00
Waffle Lapkin
8ea42fe871
Resolve FIXME in HasPayload: we've decided to not add As{Mut,Ref} bounds 2021-06-09 11:09:14 +03:00
Waffle
77253422f8 clippy 2021-05-30 13:34:20 +03:00
Waffle
961d67ccf1 Fix formatting of ParseMode docs 2021-05-21 16:58:04 +03:00
Waffle Lapkin
6ac0ed8588
Apply suggestions from code review
Co-authored-by: Hirrolot <hirrolot@gmail.com>
2021-05-13 18:43:07 +03:00
Waffle
ecaa5d5bec Add net::default_reqwest_settings function
This function can help when users want to set up their own client setting for
one reason or another, since settings set by the function, are required for
stable work.

This function was previously private and named `sound_bot`. The old name was
confusing since safety and soundness are used in the Rust context almost
entirely for `unsafe` code, UB & co. So I've changed the name to a more
descriptive one.
2021-05-12 11:51:03 +03:00
Waffle
728313174f Use proper notable_trait attr 2021-05-08 23:49:00 +03:00
Temirkhan Myrzamadi
7faec64f95 Fix Clippy 2021-05-04 23:51:11 +06:00
Hirrolot
a068166e8d
Merge branch 'master' into api-5.2 2021-05-04 10:41:29 -07:00
Waffle Lapkin
ce1a9ece16
Merge branch 'master' into private_url 2021-05-04 18:31:18 +03:00
Waffle
c498872778 Fix clippy 2021-05-04 18:20:08 +03:00
Waffle
6c0eb174ed Move macro around 2021-05-04 16:50:49 +03:00
Waffle
39c497ca1e Update methods to TBA 5.2 2021-05-04 16:47:16 +03:00
Waffle
653c804037 Update types to TBA 5.2 2021-05-04 16:01:18 +03:00
handlerug
8a7909e7c7
Add BotKickedFromSupergroup error
Fixes teloxide/teloxide#372
2021-04-27 23:48:27 +07:00
handlerug
b3dec316e5
Add NotEnoughRightsToManagePins error
Fixes teloxide/teloxide#371
2021-04-27 23:41:14 +07:00
Hirrolot
1d20dace9a
Merge pull request #81 from teloxide/fix_docs
Fix docs
2021-04-27 06:46:34 -07:00
Waffle
a95089bc6f Fix docs
`doc_spotlight` nightly feature was renamed to `doc_notable_trait`
2021-04-27 12:25:15 +03:00
Waffle
a7d07a770c Update CHANGELOG and remove unused imports 2021-04-27 12:17:14 +03:00
Waffle
ce969564ac Improve Message::url
Return urls to messages in private groups (t.me/c) when applicable.
2021-04-27 12:01:19 +03:00
Waffle
bd52e93cdb Add missing Chat::message_auto_delete_time field (tba 5.1) 2021-04-27 12:00:54 +03:00
Waffle
b55bdd274b Add Chat getters
Add getters for all `Chat` fields nested in `ChatKind`.
`Chat` has a lot of nested enums and so is hard to match on.
The getters help with this.

This patch also corrects type of `slow_mode_delay`: `Option<i32>`` -> `Option<u32>``
2021-04-27 11:42:31 +03:00
Waffle
5d0713e742 Fix return types of methods
Fix return types of LeaveChat, PinChatMessage, SetChatDescription, SetChatPhoto,
SetChatTitle, UnpinAllChatMessages and UnpinChatMessage: String => True
2021-04-22 17:34:47 +03:00
Waffle
c73e73ad02 fmt 2021-03-30 16:38:24 +03:00
Waffle Lapkin
ccdcda68d4
Merge branch 'master' into chat_member_methods 2021-03-30 16:26:46 +03:00
Waffle Lapkin
747898c310
Apply suggestions from code review
Co-authored-by: Hirrolot <hirrolot@gmail.com>
2021-03-30 16:24:41 +03:00
Waffle Lapkin
5b99565289
Apply suggestions from code review
Co-authored-by: Hirrolot <hirrolot@gmail.com>
2021-03-30 16:22:49 +03:00
Waffle Lapkin
16d0852e4a
Apply suggestions from code review
Co-authored-by: Hirrolot <hirrolot@gmail.com>
2021-03-30 15:04:44 +03:00
Hirrolot
2ab7d30ad2
Merge pull request #76 from teloxide/derive_clone
`impl Clone` for {`CacheMe<_>`, `DefaultParseMode<_>`, `Throttle<_>`}
2021-03-30 04:41:13 -07:00
Waffle
44a044af02 impl Clone for {CacheMe<_>, DefaultParseMode<_>, Throttle<_>} 2021-03-30 12:17:49 +03:00
Waffle
528187d7e6 Fix SendChatAction return type 2021-03-29 13:49:52 +03:00
Waffle
23cf363271 Prevent year 2038 problem in ChatMember
This patch changes the Type of `{Restricted,Kicked}::until_date` fields:
`i32` => `i64`.

This is done to fix so called "year 2038 problem"
(See <https://en.wikipedia.org/wiki/Year_2038_problem>).
2021-03-29 10:20:03 +03:00
Waffle
3522a23289 fix docs 2021-03-29 10:16:02 +03:00
Waffle
75aaf56d53 Add ChatMemberKind::is_anonymous method 2021-03-29 00:33:02 +03:00
Waffle
f50e1d2d45 Make rights checks easier to use 2021-03-28 16:24:06 +03:00
Waffle
9333fca3c2 Make privileges checks easier to use
Change `ChatMemberKind::can_*` methods:
- Make them return bool, instead if option
- Return appropriate result for creators
2021-03-28 16:02:42 +03:00
Waffle
2a6e9353e7 Add is_* methods to ChatMember
Among with simple `is_{creator,administrator,restricted,left,kicked}` methods
which just check `.kind`, this patch adds `is_privileged` and `is_in_chat`
compound methods, which may be usefull.
2021-03-28 15:06:45 +03:00
Waffle
c36762c7af Add Deref impl for ChatMember to allow calling kind's methods directly 2021-03-28 14:39:03 +03:00
Waffle
02cd4dc97f Fix GetChatAdministrators output type ChatMember => Vec<ChatMember> 2021-03-28 14:02:10 +03:00
Waffle
b1e7643662 Make annoying headers less annoying
Remove commit, so they won't change every time.
Also change the text to better reflect what's going on.
2021-03-28 13:49:27 +03:00
Waffle
b5003d8b34 Fix typo: ReplyMarkup::{keyboad => keyboard}
This commit adds `ReplyMarkup::keyboard}` and deprecates `ReplyMarkup::keyboad`.
2021-03-22 10:48:56 +03:00
Waffle
907d8a23a9 doc(no_inline) prelude reexports 2021-03-22 10:46:39 +03:00
Waffle
670979e5ca Release 0.2.1 2021-03-19 12:28:05 +03:00
Waffle
f4507bd3d2 Fix: types fields privacy (make fields of some types public)
The typos were found with `grep`:
```text
; grep -r -P "^    \w{2,}: .+, *$" ./src/types/*
./src/types/dice.rs:    emoji: DiceEmoji,
./src/types/dice.rs:    value: i32,
./src/types/keyboard_button.rs:    contact: Option<True>,
./src/types/keyboard_button.rs:    location: Option<True>,
./src/types/keyboard_button.rs:    poll: Option<KeyboardButtonPollType>,
./src/types/message.rs:    message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged,
./src/types/passport_element_error.rs:    message: String,
./src/types/passport_element_error.rs:    kind: PassportElementErrorKind,
./src/types/sticker_set.rs:    thumb: Option<PhotoSize>,
```

`src/types/keyboard_button.rs` can be ignored since in just contains private
helper structure.

Fields made public:
- `Dice::{emoji, value}`
- `MessageMessageAutoDeleteTimerChanged::message_auto_delete_timer_changed`
- `PassportElementError::{message, kind}`
- `StickerSet::thumb`
2021-03-19 12:28:05 +03:00
Waffle
2cdadf774f fix nightly-feature name 2021-03-18 14:32:03 +03:00
Waffle Lapkin
a7a329a53a
Merge pull request #65 from teloxide/refactor_reply_markup
refactor reply markup
2021-03-16 15:32:11 +03:00
Waffle
36557573aa Refactor ReplyMarkup
This commit tries to make using ReplyMarkup less noisy. It
- Renames `ReplyMarkup::{InlineKeyboardMarkup => InlineKeyboard, ReplyKeyboardMarkup => Keyboard, ReplyKeyboardRemove => KeyboardRemove}`
- Adds `inline_kb`, `keyboad`, `kb_remove` and `force_reply` `ReplyMarkup`
  consructors
- Renames `ReplyKeyboardMarkup` => `KeyboardMarkup`
- Renames `ReplyKeyboardRemove` => `KeyboardRemove`
- Removes useless generic param from `ReplyKeyboardMarkup::new` and
  `InlineKeyboardMarkup::new`
- Changes parameters order in `ReplyKeyboardMarkup::append_to_row` and
  `InlineKeyboardMarkup::append_to_row`
2021-03-16 15:14:32 +03:00
Waffle Lapkin
510b0c9ac0
Make MediaContact::contact public 2021-03-16 14:16:40 +03:00
Waffle
3489890230 fix CI 2021-03-16 14:06:22 +03:00
Waffle
084caa9c12 fix doc link 2021-03-16 13:53:52 +03:00
Waffle
c8939dff09 Turn on nightly clippy again
The fix of the bug finally got released
2021-03-15 23:50:09 +03:00
Waffle
aef88f97c3 Update to tba API version 5.1 2021-03-15 23:50:02 +03:00
Waffle
9abb6d6884 Small fixes 2021-03-14 23:18:07 +03:00
Waffle
467477d38e Update changelog & readme 2021-03-14 22:59:49 +03:00
Waffle
fa5ab5aa7c Update methods to tba 5.0 2021-03-14 22:55:25 +03:00
Waffle
20c67a18c5 Update types (tba API 5.0)
See more: https://core.telegram.org/bots/api#november-4-2020
2021-03-14 22:52:35 +03:00
Temirkhan Myrzamadi
e400fb16e7 Use serde_json::from_value in Update::try_parse 2021-03-13 21:38:05 +06:00
Temirkhan Myrzamadi
cd9a98163c Fix SemiparsedVec::from 2021-03-13 21:11:54 +06:00
Temirkhan Myrzamadi
32b446d26c Move log::error! on update parsing failure to Update::try_parse 2021-03-13 21:05:45 +06:00
Temirkhan Myrzamadi
61eed38c32 Fix SemiparsedVec 2021-03-13 17:46:16 +06:00
Temirkhan Myrzamadi
f87b4e51e6
Merge branch 'master' into fault_tolerant_get_updates 2021-03-06 12:11:38 +03:00
Waffle
b3d8d70a7c remove unused use 2021-03-06 10:58:18 +03:00
Waffle
7600a88312 Fix SetWebhook
Make `GetUpdates::allowed_updates` optional
2021-03-06 00:48:06 +03:00
Temirkhan Myrzamadi
b465da5f16 Derive Clone for AutoSend 2021-02-28 22:32:50 +06:00
Temirkhan Myrzamadi
c2aaa724f4 NonStrictVec -> SemiparsedVec 2021-02-27 18:52:11 +06:00
Temirkhan Myrzamadi
466dbe6f8d Fix a documentation typo 2021-02-27 18:38:02 +06:00
Waffle
7e43c4d321 Add GetUpdatesFaultTolerant 2021-02-27 01:07:57 +03:00
Waffle
7025de58f5 Fix typos in payloads
- `get_updates`: `offset` `i64` -> `i32`
- `send_location`: make `live_period` optional
2021-02-22 11:30:13 +03:00
Waffle
dcdba78285 Fix send_contact singnature
- `phone_number: f64` -> `phone_number: String`
- `first_name: f64` -> `first_name: String`
2021-02-22 08:47:50 +03:00
Waffle
7c18750a8f Remove dbg! print 2021-02-17 14:23:13 +03:00
Waffle
80329f8a1e Throttle: make comment up to date & add channel fn 2021-02-16 19:07:50 +03:00
Waffle
72306c39d9 Limit queue growth in throttle 2021-02-16 18:49:18 +03:00
Waffle
669d6c95be Make some cleanup of throttle 2021-02-16 18:34:19 +03:00
Waffle
417b8eb1e1 Add #[non_exhaustive] on InputFile 2021-02-16 17:16:27 +03:00
Waffle
8abf3863e5 Future proof multipart requests 2021-02-16 17:16:20 +03:00
Temirkhan Myrzamadi
557002b43a
Merge pull request #46 from teloxide/refactor-throttle
Refactor requests throttling
2021-02-15 23:17:29 +03:00
Temirkhan Myrzamadi
0d25d357d9 Reformat throttle.rs 2021-02-16 02:09:06 +06:00
Temirkhan Myrzamadi
8deaac04fa Fix Clippy 2021-02-16 02:03:04 +06:00
Temirkhan Myrzamadi
65c98741db Apply suggestions from the review 2021-02-16 01:57:59 +06:00
Temirkhan Myrzamadi
916a774c88
Update src/adaptors/throttle.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2021-02-15 22:44:19 +03:00
Temirkhan Myrzamadi
d58b21c42f Refactoring 2021-02-16 00:50:46 +06:00
Temirkhan Myrzamadi
3129d709fe Small enhancements 2021-02-15 16:46:31 +06:00
Temirkhan Myrzamadi
3485acb2b4
Merge pull request #47 from teloxide/update_changelog
update changelog
2021-02-15 11:43:57 +03:00
Waffle
91220befb6 fix warning 2021-02-15 00:35:53 +03:00
Temirkhan Myrzamadi
d8c16d420d refactor(throttle): small renamings 2021-02-12 18:20:20 +06:00
Waffle
ab76ec07f2 fix docs 2021-02-07 02:41:29 +03:00
Waffle
21ecc39dc7 fix test 2021-02-07 01:50:53 +03:00
Waffle
fc88c72a26 Suppress clippy::upper_case_acronyms for Currency and CountryCode 2021-02-06 19:25:36 +03:00
Waffle
8befcffe26 Fix naming that triggers clippy::upper_case_acronyms lint
Rename
- ParseMode::{HTML => Html}
- ApiError::{
    InvalidQueryID => InvalidQueryId,
    ButtonURLInvalid => ButtonUrlInvalid,
    WrongFileID => WrongFileId,
    WebhookRequireHTTPS => WebhookRequireHttps,
    WrongHTTPurl => WrongHttpUrl,
  }
2021-02-06 19:23:16 +03:00
Waffle
ec58a59903 Fix SendMediaGroup return type
Message -> Vec<Message>
2021-02-05 21:32:21 +03:00
Waffle
311a5b18fe fix docs 2021-01-26 18:39:10 +03:00
Waffle
0e43c32b82 clippy 2021-01-26 18:31:15 +03:00
Waffle
eaf72bd97d remove unused function 2021-01-26 16:53:49 +03:00
Waffle
cf4330d892 fix 1584 line error 2021-01-26 16:52:33 +03:00
Waffle
a26935d51a remove SendInvoice from types
- It's a method not a telegram type
- We already have SendInvoice ~at home~ in payloads

Existence of the file was an accident
2021-01-26 16:46:34 +03:00
Waffle
0ef0526743 Replace Into<Vec<_>> by IntoIterator<Item = _> 2021-01-26 16:34:22 +03:00
Waffle
bd4dba3bf1 Remove MessageEntity::text_from because it's wrong
(the method assumes UTF-8 indices, but the indices are UTF-16)
(fuck you, telegram)
2021-01-26 16:21:47 +03:00
Waffle
09d0d886fa Refactor KeyboardButtonPollType
- Make it enum
- Rename `ButtonRequest::KeyboardButtonPollType` => `<_>::poll`
2021-01-26 16:02:05 +03:00
Waffle
393f6ee7a4 Cleanup setters in types::*
- Remove useless setters for types which are only returned from telegam
- Add `const` on setters (where possible)
- Make `Poll::{open_period,close_date}` public
2021-01-26 15:35:08 +03:00
Waffle
d663879423 fix example and add --features full to ci 2021-01-26 14:52:50 +03:00
Waffle
8807cd7228 fix examples (because get_me now returns Me) 2021-01-26 14:10:37 +03:00
Waffle
a80ff92aba make get_me return Me 2021-01-26 13:58:51 +03:00
Waffle
5b328105fa Sticker related fixes
- Rename `sticker_type.rs` => `input_sticker.rs` (after the contained type)
- Make `create_new_sticker_set` multipart
- Replace CreateNewStickerSet::{png,tgs}_sticker with `<_>::sticker`
- Fix GetStickerSet return type
- Revert some previous InputSticker changes: make the variants tuple structsm
  remove constructors
2021-01-26 13:43:21 +03:00
Waffle
b16006ec9c document tls features 2021-01-26 11:56:42 +03:00
Temirkhan Myrzamadi
53f1c6d4d3
Merge pull request #42 from teloxide/use_2018_module_style
use 2018 module style
2021-01-25 23:33:50 +06:00
Waffle
1f4d29c547 Add note that serde_multipart is awful 2021-01-23 15:59:59 +03:00
Waffle
55c02e3311 Use edition-2018 style modules
Use `module_name.rs` instead of `module_name/mod.rs`.

Pros:
- It's easier to find the module file (especially for modules with lots of
  submodules like `types`)
- Module file name is not 'magical'
2021-01-23 15:56:22 +03:00
Waffle
6abf571c96 Remove git dependency 2021-01-21 22:25:20 +03:00
Temirkhan Myrzamadi
8e011b7e60
Merge pull request #41 from teloxide/improve_docs
Improve docs
2021-01-21 18:52:16 +06:00
Waffle
3aec4e5070 fix test 2021-01-21 10:15:02 +03:00
Waffle
cc9e3a56e6 workaround rustc bug 2021-01-21 09:45:20 +03:00
Waffle
b93947c0ab stop using serde internall module 2021-01-15 22:19:42 +03:00
Waffle
84df33dbef improve docs 2021-01-15 22:06:23 +03:00
Waffle
2ee7bb22a1 Move client_from_env from root into net 2021-01-13 16:14:02 +03:00
Waffle
7852379852 Make Currency and CountryCode ISO compatible and add docs 2021-01-13 16:08:05 +03:00
Waffle
555bfc93d5 Refactor mime type handling
- Remove `MimeWrapper` from public api
- Use `mime::Mime` in public api instead
2021-01-13 16:07:26 +03:00
Waffle
2ddbaa49ea Add forward-to-deref Requester impls
This commit adds
```rust
impl<B: Requester> Requester for D<B> { ... }
```
where `D<_>` is `&_`, `&mut _`, `Box<_>`, `Arc<_>` and `Rc<_>`.
2021-01-08 22:13:12 +03:00
Waffle
49c3afbc39 fixup send_emoji method 2021-01-08 00:44:19 +03:00
Waffle
d3ecca662b Normalize docs 2021-01-07 18:00:57 +03:00
Waffle
56d546215a fix clippy: impl From instead of Into 2021-01-07 16:01:46 +03:00
Waffle
71d90002ce update dependencies 2021-01-07 15:58:51 +03:00
Waffle
6004d9189c fmt 2020-12-30 17:06:52 +03:00
Waffle Lapkin
114d1c3efb
Update src/bot/mod.rs
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-12-30 17:03:29 +03:00
Waffle
cf3cd63c92 fix doc tests 2020-12-28 21:03:33 +03:00
Waffle
50d3d67f93 fmt 2020-12-28 19:06:46 +03:00
Waffle
f4e3aa13eb Add Bot::{set_,}api_url methods
The methods allow to set and get the Telegram bot API url.
2020-12-28 18:45:45 +03:00
Waffle
9052d4dfbb Remove already fixed FIXMEs 2020-12-28 18:02:04 +03:00
Waffle
93bc2e6fee Make requester methods doc nicer 2020-12-28 14:57:39 +03:00
Waffle
7cc79eda63 Fix API typos
- Make `caption` args optional
- Add missing game methods
2020-12-28 14:57:37 +03:00
Temirkhan Myrzamadi
109a5d89ab Satisfy rustfmt 2020-12-23 23:45:56 +06:00
Temirkhan Myrzamadi
957c997161 Merge branch 'docs-gardening' of https://github.com/teloxide/teloxide-core into docs-gardening 2020-12-23 23:41:27 +06:00
Temirkhan Myrzamadi
1188da84e3 Small typo fixes 2020-12-23 23:40:58 +06:00
Temirkhan Myrzamadi
edc12d0008
Update src/requests/payload.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2020-12-23 23:18:20 +06:00
Temirkhan Myrzamadi
f1e5f3f1b3
Update src/requests/request.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2020-12-23 23:16:49 +06:00
Temirkhan Myrzamadi
bb8148a3b3
Update src/requests/request.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2020-12-23 23:16:42 +06:00
Temirkhan Myrzamadi
18c34a7f70
Update src/requests/payload.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2020-12-23 23:16:19 +06:00
Temirkhan Myrzamadi
dc7092fed5
Update src/requests/has_payload.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2020-12-23 23:14:58 +06:00
Temirkhan Myrzamadi
914ddd40bb Add #[allow(clippy::wrong_self_convention)] 2020-12-23 22:46:31 +06:00
Temirkhan Myrzamadi
f5d9cb1a73 Documentation gardening 2020-12-23 22:24:31 +06:00
Waffle
290258cd1f Small fixes: fmt & import in test 2020-12-12 17:59:45 +03:00
Waffle
445c42b585 Refactor file downloading
- Make `net` module public
- Move `Bot::download_file{,_stream}` methods to a new `Download` trait
  - Add `download_forward` macro to forward `Download` impls (priv)
  - Impl `Download` for all bot adaptors & the `Bot` itself
- Change return type of `download_file_stream` — return `Stream<Result<Bytes>>``,
  instead of `Future<Result<Stream<Result<Bytes>>>>``
- Add `api_url` param to standalone versions of `download_file{,_stream}`
- Make `net::{TELEGRAM_API_URL, download_file{,_stream}}` pub
- Small documentation changes
2020-12-12 15:52:47 +03:00
Waffle
3491a668b2 Fix doc links... 2020-12-06 16:34:44 +03:00
Waffle
1882ff0bc4 Fix doc test 2020-12-06 16:31:30 +03:00
Waffle
84ac0212e8 Remove legacy code 2020-12-06 16:31:28 +03:00
Waffle
eb45ac7d88 Fix doc links 2020-11-27 01:39:35 +03:00
Waffle
45cf62ce8e Refactor Bot for a bit
- Move default parse mode to an adaptor
- Remove bot builder (it's not usefull anymore, since parse_mode is moved away)
    - Undeprecate bot constructors
2020-11-27 01:21:50 +03:00
Waffle
7c9c871b83 Remove empty generics lists, wheres and ', ' after self 2020-11-24 20:30:45 +03:00
Waffle
d7d8bc6246 Add all tba methods to Requester trait 2020-11-24 19:32:29 +03:00
Temirkhan Myrzamadi
b4e0a355c3
Merge pull request #26 from teloxide/intrl_api_url_chage
Add internal ability to change API url
2020-11-21 04:01:28 +06:00
Waffle
05582de2fd Add fixme to #[allow] attr in api_url 2020-11-17 22:43:34 +03:00
Waffle
17b44db578 Add ApiUrl
Add `ApiUrl` and also use `Url` instead of `&str` for urls to clean code
2020-11-17 22:38:30 +03:00
Waffle
fa0e86c547 Add internal ability to change API url
Recently, telegram has published [Telegram Bot API Server] - HTTP API <->
MTPROTO proxy which is used internally by telegram. Now it's possible to run
the server locally.

However currently it's not possible to use teloxide with such local server,
because API url is hardcoded into teloxide.

This commit makes _internall_ changes to allow setting the API url. It doesn't
yet allow to set the url from user code (i.e.: no changes in public API), in my
opinion such additions are blocked on some bot refactorings.

`Bot::api_url` is made `Option<Arc<str>>` to minimize costs in case of 'default
url' (probably the most common case).

Progress of this issue is tracked in https://github.com/teloxide/teloxide/issues/317

[Telegram Bot API Server]: https://github.com/tdlib/telegram-bot-api
2020-11-16 14:14:00 +03:00
Waffle
19c375f5e0 fix message_id type 2020-11-16 12:58:55 +03:00
Waffle
40bbfb05ea fixup SendInvice::chat_id type 2020-11-16 02:48:24 +03:00
Waffle
5d576455d9 fix user_id param type 2020-11-15 11:24:38 +03:00
Waffle Lapkin
79b5c41bb5
Apply suggestions from code review
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-11-15 10:51:36 +03:00
Waffle
62b65cb7a6 clippy 2020-11-13 20:47:47 +03:00
Waffle
f0609c06bc Add docs for setters mod 2020-11-13 19:15:09 +03:00
Waffle
8f85cffe94 Implement all payloads 2020-11-13 19:04:54 +03:00
Waffle
0deb42e167 fix docs for InputSticker 2020-11-05 03:25:32 +03:00
Waffle
a213459cc3 fmt 2020-11-05 03:22:23 +03:00
Waffle
9d887e51bb Rename StickerType
- Rename `StickerType` => `InputSticker`
- Rename `{CreateNewStickerSet,AddStickerToSet}::sticker_type}` => `sticker`

This just makes more sense.
2020-11-04 16:00:40 +03:00
Waffle
a138d6824b add #[must_use] attr to payloads implemented by macro 2020-11-02 21:14:32 +03:00
Waffle
106c49fa46 add #[serde_with_macros::skip_serializing_none] annotation to the impl_payload output 2020-11-02 02:21:02 +03:00
Waffle
5ddbd50b37 Implement IntoIterator-based convert for impl_payload! macro 2020-11-02 01:35:02 +03:00
Temirkhan Myrzamadi
59f01a72c0
Merge pull request #20 from teloxide/fix_message_dice
make MessageDice::dice public
2020-10-29 12:48:39 +06:00
Waffle
6ae9db4edd make MessageDice::dice public 2020-10-28 19:05:28 +03:00
Temirkhan Myrzamadi
8a5081db61
Merge pull request #18 from teloxide/impl_payload_macro
Add internal impl_payload macro
2020-10-27 18:51:23 +06:00
Waffle
4b21e8ea68 fmt 2020-10-24 22:20:58 +03:00
Temirkhan Myrzamadi
2e88ba3002
Merge pull request #19 from teloxide/fix_telegram_response
Fix telegram response
2020-10-25 00:19:45 +06:00
Waffle Lapkin
a917363da0
Merge branch 'master' into impl_payload_macro 2020-10-24 21:16:05 +03:00
Waffle
fe9314f87c serde-rename TelegramResponse::reponse to result 2020-10-24 09:23:28 +03:00
Waffle
69d503e610 add internal impl_payload macro 2020-10-24 09:13:11 +03:00
Waffle
d2b97b2120 Use #[serde(field_identifier)] instead of hand-made workarounds
This attribute doesn't seem to be documented btw...
2020-10-22 00:42:06 +03:00
Waffle
2dfe8a15c5 fmt 2020-10-21 19:53:39 +03:00
Waffle
d47036012b fix rebase mistakes 2020-10-21 19:51:00 +03:00
Waffle
9bf8c02c9d doc & feature fixes
- Remove `unstable-stream` feature
- Doc fixes
2020-10-21 05:17:35 +03:00
Waffle
e79f83d4a1 Move bot adaptors to own module and place then under features
This commit moves `bot::{auto_send,cache_me,limits}` modules to
`adaptors::{auto_send,cache_me,throttle}.

ALso it adds 4 crate features:
- `throttle`
- `cache_me`
- `auto_send`
- `full` (enables all features, except `nightly`)
2020-10-21 05:14:48 +03:00
Temirkhan Myrzamadi
2d948ef20b
Merge pull request #13 from teloxide/cleanup_errors
Cleanup errors
2020-10-21 04:34:14 +06:00
Waffle
41afdb554d fmt 2020-10-20 17:02:31 +03:00
Waffle
193dd69265 Cleanup errors 2020-10-20 15:07:10 +03:00
Waffle
e54f45ceab Make the trait bounds in Request{,er} stricter 2020-10-20 12:17:07 +03:00
Temirkhan Myrzamadi
a2d87fe1fa
Merge pull request #10 from teloxide/limits
Request throttling (limits)
2020-10-17 23:47:19 +06:00
Temirkhan Myrzamadi
41b257bbae
Merge pull request #9 from teloxide/chat_member_kind
Refactor ChatMember
2020-10-10 17:22:39 +06:00
Waffle
2f09e9930d Decompose ChatMemberKind as was requested per review 2020-10-10 14:17:52 +03:00
Waffle
8e44a0bcfc fmt: i can't see the difference 2020-10-03 03:39:50 +03:00
Waffle
2d7e40a473 [throttle] fix doc test 2020-10-03 03:30:34 +03:00
Waffle
e757999135 [throttle] git rebase, fmt and clippy things 2020-10-02 21:22:19 +03:00
Waffle
0aecda6348 [throttle] stop worker when channel is closed 2020-10-02 20:53:00 +03:00
Waffle
d43f2514d3 [throttle] use channel close to send unlock "messages"
Also use `with_capacity` for queue
2020-10-02 20:53:00 +03:00
Waffle
380e189ec7 [throttle] comment and doc improvements 2020-10-02 20:53:00 +03:00
Waffle
6f03ca0954 [throttle] hash ChatId::ChannelUsername to prevent expensive string cloning & make send{,_ref} enums private
The future has come!
2020-10-02 20:53:00 +03:00
Waffle
7fdf9cd9a6 [throttle] implement send_ref 2020-10-02 20:53:00 +03:00
Waffle
247868a815 [throttle] explicit queue-closed error handling & comments 2020-10-02 20:53:00 +03:00
Waffle
23ef060d08 [throttle] temporary resolve spawn_blocking fixme 2020-10-02 20:53:00 +03:00
Waffle
b38e35b630 [throttle] format, docs, modfix and small additions 2020-10-02 20:52:56 +03:00
Waffle
6714a9c503 [throttle] clear hchats_s instead of creating&dropping every iteration 2020-10-02 20:50:30 +03:00
Waffle
5f5e42054d [throttle] queue optimizations#1 2020-10-02 20:50:30 +03:00
Waffle
3f9db1f31b [throttle] queue optimizations#0 2020-10-02 20:50:30 +03:00
Waffle
f270613e7e [throttle] refactor#0
- Move all data to the worker making it unshared.
- Use mpsc channel to update requests queue
- Yield if there are no requests in queue
- Remove `:0` entries from `hchats`
- Remove debug prints
- Remove use of `block_on`
2020-10-02 20:50:30 +03:00
Waffle
4e412b39e1 (very bad) initial implementation of throttling 2020-10-02 20:50:30 +03:00
Waffle
8271150218 add SendMessage request 2020-10-02 20:50:30 +03:00
Waffle Lapkin
269859eba9
Update src/bot/auto_send.rs
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-10-01 21:11:28 +03:00
Waffle Lapkin
a7066e5e11
Apply suggestions from code review
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-10-01 21:08:38 +03:00
Waffle Lapkin
429ab0b74a
Apply suggestions from code review
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-10-01 21:00:02 +03:00
Waffle
57afa34609 rephase 2020-09-23 23:44:53 +03:00
Waffle
f4b11095a7 fmt 2020-09-23 22:06:23 +03:00
Waffle
cd5d6fd6b9 Make AutoRequest<_> fused 2020-09-23 21:52:09 +03:00
Waffle
91d78b65b3 Refactor ChatMember
- Replace a bunch of `Option<_>` fields with `hatMemberKind`
- Remove setters (users are not expected to create this struct)
- Add getters
2020-09-23 19:05:59 +03:00
Waffle
0ec81cf753 Implement auto sending requests 2020-09-23 16:53:26 +03:00
Waffle
83cc634f79 add :std::error::Error bound on Request::Err 2020-09-22 22:56:02 +03:00
Waffle
954c410c1b implement get_me caching 2020-09-22 22:55:19 +03:00
Waffle
2cabc5fb4e add Requester trait and GetMe payload 2020-09-22 22:52:23 +03:00
Waffle
f3e0005335 remove AsMut/AsRef bounds because of a compiler bug 2020-09-22 22:48:42 +03:00
Waffle
07a403c279 implement default Bot's {Json,Multipart}Request 2020-09-19 20:30:36 +03:00
Waffle Lapkin
f272326c69
Merge pull request #5 from teloxide/requests_redisign_p0
Requests redisign part 0
2020-08-25 17:30:04 +03:00
Waffle
88004607d3 fmt 2020-08-24 17:08:55 +03:00
Waffle
c773ce7aff implement HasPayload in terms of As{Ref,Mut} 2020-08-24 15:50:15 +03:00
Waffle
76d47276f6 requests redesign part 0
This commit introduces 3 traits mentioned in requests redesign proposal:
- `Payload`
- `HasPayload`
- `Request`

Also it adds `Output<T>` alias to `<<T as HasPayload>::Payload as Payload>::Output`
2020-08-22 22:03:59 +03:00
Waffle
45a55c66de rename Request => RequestOld 2020-08-22 20:59:04 +03:00
Waffle Lapkin
481b2ee564
Merge pull request #3 from teloxide/pub_fields_in_methods
make all methods fields public
2020-08-16 23:38:26 +03:00
Waffle
fd64e17f4c remove all #[non_exhaustive]s 2020-08-16 21:24:35 +03:00
Waffle
d4c0bc2fe1 make all methods fields public 2020-08-16 21:10:42 +03:00
Waffle
d186a73eda add GetUpdatesNonStrict 'telegram' method - fail proof version of GetUpdates 2020-08-16 20:02:12 +03:00
Waffle Lapkin
891106cabe
Update src/errors.rs
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-08-16 14:44:08 +03:00
Waffle
f0709a16b3 add changes to CHANGELOG.md
(& a bit of fmt 🤦)
2020-08-16 11:06:50 +03:00
Waffle
f7aef22fbf make StickerType::{png,tgs} pub 2020-08-16 10:58:10 +03:00
Waffle
72b776d859 some cleanup (serde_multipart) 2020-08-16 10:53:15 +03:00
Waffle
5afe72b368 rewrite requests to use serde-multipart
Rewrite multipart requests to use serde_multipart instead of FromBuilder
2020-08-16 00:21:55 +03:00
Waffle
b303958afd implement serde multipart serializer
Serde multipart serializer can be used to serialize requests
into multipart/form-data without need for copy-paste and boilerplate
2020-08-16 00:21:01 +03:00
Waffle
06f123710e add RequestError::Io to wrap I/O errors
Add `RequestError::Io(std::io::Error)` to wrap I/O errors those may happen
while reading files to upload them to telegram
2020-08-15 23:52:08 +03:00
Waffle
842a084abf replace teloxide with teloxide_core in doc tests 2020-08-12 20:23:18 +03:00
Waffle
a70cb4e008 Move core code from teloxide 2020-08-12 19:39:40 +03:00