Commit graph

79 commits

Author SHA1 Message Date
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
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
Waffle
c1eca613d5 Fix Clippy: remove useless (immediately implicitly dereferenced) refs 2021-06-09 11:34:40 +03:00
Waffle
961d67ccf1 Fix formatting of ParseMode docs 2021-05-21 16:58:04 +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
c498872778 Fix clippy 2021-05-04 18:20:08 +03:00
Waffle
653c804037 Update types to TBA 5.2 2021-05-04 16:01:18 +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
c73e73ad02 fmt 2021-03-30 16:38:24 +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
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
b5003d8b34 Fix typo: ReplyMarkup::{keyboad => keyboard}
This commit adds `ReplyMarkup::keyboard}` and deprecates `ReplyMarkup::keyboad`.
2021-03-22 10:48:56 +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 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
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
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
c2aaa724f4 NonStrictVec -> SemiparsedVec 2021-02-27 18:52:11 +06: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
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
Waffle
ab76ec07f2 fix docs 2021-02-07 02:41:29 +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
311a5b18fe fix docs 2021-01-26 18:39:10 +03:00
Waffle
0e43c32b82 clippy 2021-01-26 18:31:15 +03:00