mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-25 01:25:12 +01:00
Merge pull request #133 from teloxide/api-5.4
TBA 5.4 and schema updates
This commit is contained in:
commit
407fbe0214
43 changed files with 271 additions and 77 deletions
|
@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
|
||||
- `ApiError::TooMuchInlineQueryResults` ([#135][pr135])
|
||||
- `EditedMessageIsTooLong` error [#109][pr109]
|
||||
- Support for 5.4 telegram bot API ([#133][pr133])
|
||||
- `EditedMessageIsTooLong` error ([#109][pr109])
|
||||
- `UntilDate` enum and use it for `{Restricted, Banned}::until_date` ([#116][pr116])
|
||||
- `Limits::messages_per_min_channel` ([#121][pr121])
|
||||
|
||||
|
@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Implement `Error` for `ApiError`
|
||||
- Use `url::Url` for urls, use `chrono::DateTime<Utc>` for dates in types ([#115][pr115])
|
||||
- Mark `ApiError` as `non_exhaustive` ([#125][pr125])
|
||||
- `InputFile` and related structures now do **not** implement `PartialEq`, `Eq` and `Hash` ([#133][pr133])
|
||||
|
||||
[pr115]: https://github.com/teloxide/teloxide-core/pull/115
|
||||
[pr125]: https://github.com/teloxide/teloxide-core/pull/125
|
||||
|
@ -40,8 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Type of `Poll::correct_option_id`: `i32` -> `u8` ([#119][pr119])
|
||||
- Type of `Poll::open_period`: `i32` -> `u16` ([#119][pr119])
|
||||
- `Throttle` adaptor not honouring chat/min limits ([#121][pr121])
|
||||
- Make `SendPoll::poll_` optional ([#133][pr133])
|
||||
|
||||
[pr119]: https://github.com/teloxide/teloxide-core/pull/119
|
||||
[pr133]: https://github.com/teloxide/teloxide-core/pull/133
|
||||
|
||||
## 0.3.3 - 2021-08-03
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ where
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => f, fty
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ where
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => f, fty
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
|||
requests::{HasPayload, Output, Payload, Request, Requester},
|
||||
types::{
|
||||
BotCommand, ChatAction, ChatId, ChatPermissions, InlineQueryResult, InputFile, InputMedia,
|
||||
InputSticker, LabeledPrice, PassportElementError, PollType, TargetMessage,
|
||||
InputSticker, LabeledPrice, PassportElementError, TargetMessage,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -181,6 +181,7 @@ where
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => fwd_erased, fty
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +331,6 @@ trait ErasableRequester<'a> {
|
|||
chat_id: ChatId,
|
||||
question: String,
|
||||
options: Vec<String>,
|
||||
type_: PollType,
|
||||
) -> ErasedRequest<'a, SendPoll, Self::Err>;
|
||||
|
||||
fn send_dice(&self, chat_id: ChatId) -> ErasedRequest<'a, SendDice, Self::Err>;
|
||||
|
@ -414,6 +414,20 @@ trait ErasableRequester<'a> {
|
|||
invite_link: String,
|
||||
) -> ErasedRequest<'a, RevokeChatInviteLink, Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`ApproveChatJoinRequest`].
|
||||
fn approve_chat_join_request(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
user_id: i64,
|
||||
) -> ErasedRequest<'a, ApproveChatJoinRequest, Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`DeclineChatJoinRequest`].
|
||||
fn decline_chat_join_request(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
user_id: i64,
|
||||
) -> ErasedRequest<'a, DeclineChatJoinRequest, Self::Err>;
|
||||
|
||||
fn set_chat_photo(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
|
@ -869,9 +883,8 @@ where
|
|||
chat_id: ChatId,
|
||||
question: String,
|
||||
options: Vec<String>,
|
||||
type_: PollType,
|
||||
) -> ErasedRequest<'a, SendPoll, Self::Err> {
|
||||
Requester::send_poll(self, chat_id, question, options, type_).erase()
|
||||
Requester::send_poll(self, chat_id, question, options).erase()
|
||||
}
|
||||
|
||||
fn send_dice(&self, chat_id: ChatId) -> ErasedRequest<'a, SendDice, Self::Err> {
|
||||
|
@ -985,6 +998,24 @@ where
|
|||
Requester::revoke_chat_invite_link(self, chat_id, invite_link).erase()
|
||||
}
|
||||
|
||||
/// For Telegram documentation see [`ApproveChatJoinRequest`].
|
||||
fn approve_chat_join_request(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
user_id: i64,
|
||||
) -> ErasedRequest<'a, ApproveChatJoinRequest, Self::Err> {
|
||||
Requester::approve_chat_join_request(self, chat_id, user_id).erase()
|
||||
}
|
||||
|
||||
/// For Telegram documentation see [`DeclineChatJoinRequest`].
|
||||
fn decline_chat_join_request(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
user_id: i64,
|
||||
) -> ErasedRequest<'a, DeclineChatJoinRequest, Self::Err> {
|
||||
Requester::decline_chat_join_request(self, chat_id, user_id).erase()
|
||||
}
|
||||
|
||||
fn set_chat_photo(
|
||||
&self,
|
||||
chat_id: ChatId,
|
||||
|
|
|
@ -84,19 +84,13 @@ impl<B: Requester> Requester for DefaultParseMode<B> {
|
|||
|
||||
type SendPoll = B::SendPoll;
|
||||
|
||||
fn send_poll<C, Q, O>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
question: Q,
|
||||
options: O,
|
||||
type_: PollType,
|
||||
) -> Self::SendPoll
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
O: IntoIterator<Item = String>,
|
||||
{
|
||||
let mut req = self.inner().send_poll(chat_id, question, options, type_);
|
||||
let mut req = self.inner().send_poll(chat_id, question, options);
|
||||
req.payload_mut().explanation_parse_mode = Some(self.mode);
|
||||
req
|
||||
}
|
||||
|
@ -122,6 +116,7 @@ impl<B: Requester> Requester for DefaultParseMode<B> {
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => fid, fty
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,6 +619,7 @@ where
|
|||
add_sticker_to_set, set_sticker_position_in_set, delete_sticker_from_set,
|
||||
set_sticker_set_thumb, answer_shipping_query, answer_pre_checkout_query,
|
||||
set_passport_data_errors, send_game, set_game_score, set_game_score_inline,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_game_high_scores, get_updates_fault_tolerant => fid, ftyid
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ where
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => fwd_inner, fty
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,13 +270,7 @@ impl Requester for Bot {
|
|||
|
||||
type SendPoll = JsonRequest<payloads::SendPoll>;
|
||||
|
||||
fn send_poll<C, Q, O>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
question: Q,
|
||||
options: O,
|
||||
type_: crate::types::PollType,
|
||||
) -> Self::SendPoll
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
|
@ -284,7 +278,7 @@ impl Requester for Bot {
|
|||
{
|
||||
Self::SendPoll::new(
|
||||
self.clone(),
|
||||
payloads::SendPoll::new(chat_id, question, options, type_),
|
||||
payloads::SendPoll::new(chat_id, question, options),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -469,6 +463,30 @@ impl Requester for Bot {
|
|||
)
|
||||
}
|
||||
|
||||
type ApproveChatJoinRequest = JsonRequest<payloads::ApproveChatJoinRequest>;
|
||||
|
||||
fn approve_chat_join_request<C>(&self, chat_id: C, user_id: i64) -> Self::ApproveChatJoinRequest
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::ApproveChatJoinRequest::new(
|
||||
self.clone(),
|
||||
payloads::ApproveChatJoinRequest::new(chat_id, user_id),
|
||||
)
|
||||
}
|
||||
|
||||
type DeclineChatJoinRequest = JsonRequest<payloads::DeclineChatJoinRequest>;
|
||||
|
||||
fn decline_chat_join_request<C>(&self, chat_id: C, user_id: i64) -> Self::DeclineChatJoinRequest
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::DeclineChatJoinRequest::new(
|
||||
self.clone(),
|
||||
payloads::DeclineChatJoinRequest::new(chat_id, user_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SetChatPhoto = MultipartRequest<payloads::SetChatPhoto>;
|
||||
|
||||
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
|
||||
|
|
|
@ -651,11 +651,11 @@ macro_rules! requester_forward {
|
|||
(@method send_poll $body:ident $ty:ident) => {
|
||||
type SendPoll = $ty![SendPoll];
|
||||
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O, type_: PollType) -> Self::SendPoll where C: Into<ChatId>,
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll where C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
O: IntoIterator<Item = String> {
|
||||
let this = self;
|
||||
$body!(send_poll this (chat_id: C, question: Q, options: O, type_: PollType))
|
||||
$body!(send_poll this (chat_id: C, question: Q, options: O))
|
||||
}
|
||||
};
|
||||
(@method send_dice $body:ident $ty:ident) => {
|
||||
|
@ -781,6 +781,22 @@ macro_rules! requester_forward {
|
|||
$body!(revoke_chat_invite_link this (chat_id: C, invite_link: I))
|
||||
}
|
||||
};
|
||||
(@method approve_chat_join_request $body:ident $ty:ident) => {
|
||||
type ApproveChatJoinRequest = $ty![ApproveChatJoinRequest];
|
||||
|
||||
fn approve_chat_join_request<C>(&self, chat_id: C, user_id: i64) -> Self::ApproveChatJoinRequest where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(approve_chat_join_request this (chat_id: C, user_id: i64))
|
||||
}
|
||||
};
|
||||
(@method decline_chat_join_request $body:ident $ty:ident) => {
|
||||
type DeclineChatJoinRequest = $ty![DeclineChatJoinRequest];
|
||||
|
||||
fn decline_chat_join_request<C>(&self, chat_id: C, user_id: i64) -> Self::DeclineChatJoinRequest where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(decline_chat_join_request this (chat_id: C, user_id: i64))
|
||||
}
|
||||
};
|
||||
(@method set_chat_photo $body:ident $ty:ident) => {
|
||||
type SetChatPhoto = $ty![SetChatPhoto];
|
||||
|
||||
|
|
|
@ -25,11 +25,13 @@ mod answer_callback_query;
|
|||
mod answer_inline_query;
|
||||
mod answer_pre_checkout_query;
|
||||
mod answer_shipping_query;
|
||||
mod approve_chat_join_request;
|
||||
mod ban_chat_member;
|
||||
mod close;
|
||||
mod copy_message;
|
||||
mod create_chat_invite_link;
|
||||
mod create_new_sticker_set;
|
||||
mod decline_chat_join_request;
|
||||
mod delete_chat_photo;
|
||||
mod delete_chat_sticker_set;
|
||||
mod delete_message;
|
||||
|
@ -113,11 +115,13 @@ pub use answer_callback_query::{AnswerCallbackQuery, AnswerCallbackQuerySetters}
|
|||
pub use answer_inline_query::{AnswerInlineQuery, AnswerInlineQuerySetters};
|
||||
pub use answer_pre_checkout_query::{AnswerPreCheckoutQuery, AnswerPreCheckoutQuerySetters};
|
||||
pub use answer_shipping_query::{AnswerShippingQuery, AnswerShippingQuerySetters};
|
||||
pub use approve_chat_join_request::{ApproveChatJoinRequest, ApproveChatJoinRequestSetters};
|
||||
pub use ban_chat_member::{BanChatMember, BanChatMemberSetters};
|
||||
pub use close::{Close, CloseSetters};
|
||||
pub use copy_message::{CopyMessage, CopyMessageSetters};
|
||||
pub use create_chat_invite_link::{CreateChatInviteLink, CreateChatInviteLinkSetters};
|
||||
pub use create_new_sticker_set::{CreateNewStickerSet, CreateNewStickerSetSetters};
|
||||
pub use decline_chat_join_request::{DeclineChatJoinRequest, DeclineChatJoinRequestSetters};
|
||||
pub use delete_chat_photo::{DeleteChatPhoto, DeleteChatPhotoSetters};
|
||||
pub use delete_chat_sticker_set::{DeleteChatStickerSet, DeleteChatStickerSetSetters};
|
||||
pub use delete_message::{DeleteMessage, DeleteMessageSetters};
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::types::{InputSticker, MaskPosition, True};
|
|||
impl_payload! {
|
||||
@[multipart]
|
||||
/// Use this method to add a new sticker to a set created by the bot. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub AddStickerToSet (AddStickerToSetSetters) => True {
|
||||
required {
|
||||
/// User identifier of sticker file owner
|
||||
|
|
24
src/payloads/approve_chat_join_request.rs
Normal file
24
src/payloads/approve_chat_join_request.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// This file is auto generated by [`cg`] from [`schema`].
|
||||
//
|
||||
// **DO NOT EDIT THIS FILE**,
|
||||
//
|
||||
// Edit `cg` or `schema` instead.
|
||||
//
|
||||
// [cg]: https://github.com/teloxide/cg
|
||||
// [`schema`]: https://github.com/WaffleLapkin/tg-methods-schema
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{ChatId, True};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the _can_invite_users_ administrator right. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub ApproveChatJoinRequest (ApproveChatJoinRequestSetters) => True {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
pub chat_id: ChatId [into],
|
||||
/// Unique identifier of the target user
|
||||
pub user_id: i64,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,11 +23,15 @@ impl_payload! {
|
|||
pub chat_id: ChatId [into],
|
||||
}
|
||||
optional {
|
||||
/// Invite link name; 0-32 characters
|
||||
pub name: String [into],
|
||||
/// Point in time (Unix timestamp) when the link will expire
|
||||
#[serde(with = "crate::types::serde_opt_date_from_unix_timestamp")]
|
||||
pub expire_date: DateTime<Utc> [into],
|
||||
/// Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
|
||||
pub member_limit: u32,
|
||||
/// True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
|
||||
pub creates_join_request: bool,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::types::{InputSticker, MaskPosition, True};
|
|||
impl_payload! {
|
||||
@[multipart]
|
||||
/// Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields _png\_sticker_ or _tgs\_sticker_. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub CreateNewStickerSet (CreateNewStickerSetSetters) => True {
|
||||
required {
|
||||
/// User identifier of sticker file owner
|
||||
|
|
24
src/payloads/decline_chat_join_request.rs
Normal file
24
src/payloads/decline_chat_join_request.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// This file is auto generated by [`cg`] from [`schema`].
|
||||
//
|
||||
// **DO NOT EDIT THIS FILE**,
|
||||
//
|
||||
// Edit `cg` or `schema` instead.
|
||||
//
|
||||
// [cg]: https://github.com/teloxide/cg
|
||||
// [`schema`]: https://github.com/WaffleLapkin/tg-methods-schema
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{ChatId, True};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the _can_invite_users_ administrator right. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub DeclineChatJoinRequest (DeclineChatJoinRequestSetters) => True {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
pub chat_id: ChatId [into],
|
||||
/// Unique identifier of the target user
|
||||
pub user_id: i64,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,11 +24,15 @@ impl_payload! {
|
|||
pub invite_link: String [into],
|
||||
}
|
||||
optional {
|
||||
/// Invite link name; 0-32 characters
|
||||
pub name: String [into],
|
||||
/// Point in time (Unix timestamp) when the link will expire
|
||||
#[serde(with = "crate::types::serde_opt_date_from_unix_timestamp")]
|
||||
pub expire_date: DateTime<Utc> [into],
|
||||
/// Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
|
||||
pub member_limit: u32,
|
||||
/// True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
|
||||
pub creates_join_request: bool,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ impl_payload! {
|
|||
/// Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, the edited Message is returned.
|
||||
///
|
||||
/// See also: [`EditMessageMediaInline`](crate::payloads::EditMessageMediaInline)
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub EditMessageMedia (EditMessageMediaSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`).
|
||||
|
|
|
@ -14,7 +14,7 @@ impl_payload! {
|
|||
/// Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, _True_ is returned.
|
||||
///
|
||||
/// See also: [`EditMessageMedia`](crate::payloads::EditMessageMedia)
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub EditMessageMediaInline (EditMessageMediaInlineSetters) => True {
|
||||
required {
|
||||
/// Identifier of the inline message
|
||||
|
|
|
@ -15,7 +15,7 @@ impl_payload! {
|
|||
/// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent [`Message`] is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendAnimation (SendAnimationSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -18,7 +18,7 @@ impl_payload! {
|
|||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
/// [`SendVoice`]: crate::payloads::SendVoice
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendAudio (SendAudioSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -23,13 +23,14 @@ impl_payload! {
|
|||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
pub chat_id: ChatId [into],
|
||||
/// Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for [text messages], upload_photo for [photos], record_video or upload_video for [videos], record_audio or upload_audio for [audio files], upload_document for [general files], find_location for [location data], record_video_note or upload_video_note for [video notes].
|
||||
/// Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for [text messages], upload_photo for [photos], record_video or upload_video for [videos], record_audio or upload_audio for [audio files], upload_document for [general files], choose_sticker for [stickers], find_location for [location data], record_video_note or upload_video_note for [video notes].
|
||||
///
|
||||
/// [text messages]: crate::payloads::SendMessage
|
||||
/// [photos]: crate::payloads::SendPhoto
|
||||
/// [videos]: crate::payloads::SendVideo
|
||||
/// [audio files]: crate::payloads::SendAudio
|
||||
/// [general files]: crate::payloads::SendDocument
|
||||
/// [stickers]: crate::payloads::SendSticker
|
||||
/// [location data]: crate::payloads::SendLocation
|
||||
/// [video notes]: crate::payloads::SendVideoNote
|
||||
pub action: ChatAction,
|
||||
|
|
|
@ -15,7 +15,7 @@ impl_payload! {
|
|||
/// Use this method to send general files. On success, the sent [`Message`] is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendDocument (SendDocumentSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -14,7 +14,7 @@ impl_payload! {
|
|||
/// Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of [`Message`]s that were sent is returned.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendMediaGroup (SendMediaGroupSetters) => Vec<Message> {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -15,7 +15,7 @@ impl_payload! {
|
|||
/// Use this method to send photos. On success, the sent [`Message`] is returned.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendPhoto (SendPhotoSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -24,12 +24,12 @@ impl_payload! {
|
|||
pub question: String [into],
|
||||
/// A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
|
||||
pub options: Vec<String> [collect],
|
||||
/// Poll type, “quiz” or “regular”, defaults to “regular”
|
||||
pub type_: PollType,
|
||||
}
|
||||
optional {
|
||||
/// True, if the poll needs to be anonymous, defaults to True
|
||||
pub is_anonymous: bool,
|
||||
/// Poll type, “quiz” or “regular”, defaults to “regular”
|
||||
pub type_: PollType,
|
||||
/// True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
|
||||
pub allows_multiple_answers: bool,
|
||||
/// 0-based identifier of the correct answer option, required for polls in quiz mode
|
||||
|
|
|
@ -15,7 +15,7 @@ impl_payload! {
|
|||
/// Use this method to send static .WEBP or [animated] .TGS stickers. On success, the sent Message is returned.
|
||||
///
|
||||
/// [animated]: https://telegram.org/blog/animated-stickers
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendSticker (SendStickerSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`).
|
||||
|
|
|
@ -16,7 +16,7 @@ impl_payload! {
|
|||
///
|
||||
/// [`Document`]: crate::types::Document
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendVideo (SendVideoSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -16,7 +16,7 @@ impl_payload! {
|
|||
///
|
||||
/// [v.4.0]: https://core.telegram.org/bots/api#document
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendVideoNote (SendVideoNoteSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -17,7 +17,7 @@ impl_payload! {
|
|||
/// [`Document`]: crate::types::Document
|
||||
/// [`Audio`]: crate::types::Audio
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SendVoice (SendVoiceSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::types::{ChatId, InputFile, True};
|
|||
impl_payload! {
|
||||
@[multipart]
|
||||
/// Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SetChatPhoto (SetChatPhotoSetters) => True {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::types::{InputFile, True};
|
|||
impl_payload! {
|
||||
@[multipart]
|
||||
/// Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns _True_ on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SetStickerSetThumb (SetStickerSetThumbSetters) => True {
|
||||
required {
|
||||
/// Name of the sticker set
|
||||
|
|
|
@ -18,7 +18,7 @@ impl_payload! {
|
|||
/// If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. `https://www.example.com/<token>`. Since nobody else knows your bot's token, you can be pretty sure it's us.
|
||||
///
|
||||
/// [`Update`]: crate::types::Update
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub SetWebhook (SetWebhookSetters) => True {
|
||||
required {
|
||||
/// HTTPS url to send updates to. Use an empty string to remove webhook integration
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
#[doc(no_inline)]
|
||||
pub use crate::payloads::{
|
||||
AddStickerToSetSetters as _, AnswerCallbackQuerySetters as _, AnswerInlineQuerySetters as _,
|
||||
AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _, BanChatMemberSetters as _,
|
||||
CloseSetters as _, CopyMessageSetters as _, CreateChatInviteLinkSetters as _,
|
||||
CreateNewStickerSetSetters as _, DeleteChatPhotoSetters as _, DeleteChatStickerSetSetters as _,
|
||||
DeleteMessageSetters as _, DeleteMyCommandsSetters as _, DeleteStickerFromSetSetters as _,
|
||||
DeleteWebhookSetters as _, EditChatInviteLinkSetters as _,
|
||||
AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _,
|
||||
ApproveChatJoinRequestSetters as _, BanChatMemberSetters as _, CloseSetters as _,
|
||||
CopyMessageSetters as _, CreateChatInviteLinkSetters as _, CreateNewStickerSetSetters as _,
|
||||
DeclineChatJoinRequestSetters as _, DeleteChatPhotoSetters as _,
|
||||
DeleteChatStickerSetSetters as _, DeleteMessageSetters as _, DeleteMyCommandsSetters as _,
|
||||
DeleteStickerFromSetSetters as _, DeleteWebhookSetters as _, EditChatInviteLinkSetters as _,
|
||||
EditMessageCaptionInlineSetters as _, EditMessageCaptionSetters as _,
|
||||
EditMessageLiveLocationInlineSetters as _, EditMessageLiveLocationSetters as _,
|
||||
EditMessageMediaInlineSetters as _, EditMessageMediaSetters as _,
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::types::{File, InputFile};
|
|||
impl_payload! {
|
||||
@[multipart]
|
||||
/// Use this method to upload a .PNG file with a sticker for later use in _createNewStickerSet_ and _addStickerToSet_ methods (can be used multiple times). Returns the uploaded File on success.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub UploadStickerFile (UploadStickerFileSetters) => File {
|
||||
required {
|
||||
/// User identifier of sticker file owner
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
|||
requests::Request,
|
||||
types::{
|
||||
BotCommand, ChatAction, ChatId, ChatPermissions, InlineQueryResult, InputFile, InputMedia,
|
||||
InputSticker, LabeledPrice, PassportElementError, PollType, TargetMessage,
|
||||
InputSticker, LabeledPrice, PassportElementError, TargetMessage,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -280,13 +280,7 @@ pub trait Requester {
|
|||
type SendPoll: Request<Payload = SendPoll, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SendPoll`].
|
||||
fn send_poll<C, Q, O>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
question: Q,
|
||||
options: O,
|
||||
type_: PollType,
|
||||
) -> Self::SendPoll
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
|
@ -419,6 +413,28 @@ pub trait Requester {
|
|||
C: Into<ChatId>,
|
||||
I: Into<String>;
|
||||
|
||||
type ApproveChatJoinRequest: Request<Payload = ApproveChatJoinRequest, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`ApproveChatJoinRequest`].
|
||||
fn approve_chat_join_request<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
user_id: i64,
|
||||
) -> Self::ApproveChatJoinRequest
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type DeclineChatJoinRequest: Request<Payload = DeclineChatJoinRequest, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`DeclineChatJoinRequest`].
|
||||
fn decline_chat_join_request<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
user_id: i64,
|
||||
) -> Self::DeclineChatJoinRequest
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SetChatPhoto: Request<Payload = SetChatPhoto, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SetChatPhoto`].
|
||||
|
@ -866,6 +882,7 @@ macro_rules! forward_all {
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => fwd_deref, fty
|
||||
}
|
||||
};
|
||||
|
@ -961,6 +978,7 @@ where
|
|||
set_sticker_set_thumb, send_invoice, answer_shipping_query,
|
||||
answer_pre_checkout_query, set_passport_data_errors, send_game,
|
||||
set_game_score, set_game_score_inline, get_game_high_scores,
|
||||
approve_chat_join_request, decline_chat_join_request,
|
||||
get_updates_fault_tolerant => fwd_either, fty_either
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,29 +73,41 @@ impl std::error::Error for UnserializerError {}
|
|||
|
||||
#[test]
|
||||
fn test() {
|
||||
use crate::serde_multipart::unserializers::string::StringUnserializer;
|
||||
use crate::{
|
||||
serde_multipart::unserializers::{
|
||||
input_file::InputFileUnserializer, string::StringUnserializer,
|
||||
},
|
||||
types::InputFile,
|
||||
};
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{
|
||||
serde_multipart::unserializers::input_file::InputFileUnserializer, types::InputFile,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use std::{borrow::Cow, path::Path};
|
||||
|
||||
let value = String::from("test");
|
||||
assert_eq!(value.serialize(StringUnserializer), Ok(value));
|
||||
assert!(matches!(value.serialize(StringUnserializer), Ok(v) if v == value));
|
||||
|
||||
let value = InputFile::Url(reqwest::Url::parse("http://example.com").unwrap());
|
||||
assert_eq!(value.serialize(InputFileUnserializer::NotMem), Ok(value));
|
||||
let url = reqwest::Url::parse("http://example.com").unwrap();
|
||||
let value = InputFile::Url(url.clone());
|
||||
assert!(
|
||||
matches!(value.serialize(InputFileUnserializer::NotMem), Ok(InputFile::Url(v)) if v == url)
|
||||
);
|
||||
|
||||
let value = InputFile::FileId(String::from("file_id"));
|
||||
assert_eq!(value.serialize(InputFileUnserializer::NotMem), Ok(value));
|
||||
assert!(
|
||||
matches!(value.serialize(InputFileUnserializer::NotMem), Ok(InputFile::FileId(v)) if v == "file_id")
|
||||
);
|
||||
|
||||
let value = InputFile::Memory {
|
||||
file_name: String::from("name"),
|
||||
data: Cow::Owned(vec![1, 2, 3]),
|
||||
};
|
||||
assert_eq!(value.serialize(InputFileUnserializer::memory()), Ok(value));
|
||||
assert!(
|
||||
matches!(value.serialize(InputFileUnserializer::memory()), Ok(InputFile::Memory { file_name, data }) if file_name == "name" && *data == [1, 2, 3])
|
||||
);
|
||||
|
||||
let value = InputFile::File("a/b/c".into());
|
||||
assert_eq!(value.serialize(InputFileUnserializer::NotMem), Ok(value));
|
||||
assert!(
|
||||
matches!(value.serialize(InputFileUnserializer::NotMem), Ok(InputFile::File(v)) if v == Path::new("a/b/c"))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ pub use chat::*;
|
|||
pub use chat_action::*;
|
||||
pub use chat_id::*;
|
||||
pub use chat_invite_link::*;
|
||||
pub use chat_join_request::*;
|
||||
pub use chat_location::*;
|
||||
pub use chat_member::*;
|
||||
pub use chat_member_updated::*;
|
||||
|
@ -116,6 +117,7 @@ mod chat;
|
|||
mod chat_action;
|
||||
mod chat_id;
|
||||
mod chat_invite_link;
|
||||
mod chat_join_request;
|
||||
mod chat_location;
|
||||
mod chat_member;
|
||||
mod chat_member_updated;
|
||||
|
|
|
@ -10,10 +10,15 @@ pub struct ChatInviteLink {
|
|||
pub invite_link: String,
|
||||
/// Creator of the link
|
||||
pub creator: User,
|
||||
/// `true`, if users joining the chat via the link need to be approved by
|
||||
/// chat administrators
|
||||
pub creates_join_request: bool,
|
||||
/// `true`, if the link is primary
|
||||
pub is_primary: bool,
|
||||
/// `true`, if the link is revoked
|
||||
pub is_revoked: bool,
|
||||
/// Invite link name
|
||||
pub name: Option<String>,
|
||||
/// Point in time when the link will expire or has been
|
||||
/// expired
|
||||
#[serde(with = "crate::types::serde_opt_date_from_unix_timestamp")]
|
||||
|
@ -22,4 +27,6 @@ pub struct ChatInviteLink {
|
|||
/// Maximum number of users that can be members of the chat simultaneously
|
||||
/// after joining the chat via this invite link; 1-99999
|
||||
pub member_limit: Option<u32>,
|
||||
/// Number of pending join requests created using this link
|
||||
pub pending_join_request_count: u32,
|
||||
}
|
||||
|
|
20
src/types/chat_join_request.rs
Normal file
20
src/types/chat_join_request.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{Chat, ChatInviteLink, User};
|
||||
|
||||
/// Represents a join request sent to a chat.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ChatJoinRequest {
|
||||
/// Chat to which the request was sent
|
||||
pub chat: Chat,
|
||||
/// User that sent the join request
|
||||
pub from: User,
|
||||
/// Date the request was sent in Unix time
|
||||
#[serde(with = "crate::types::serde_date_from_unix_timestamp")]
|
||||
pub date: DateTime<Utc>,
|
||||
/// Bio of the user.
|
||||
pub bio: Option<String>,
|
||||
/// Chat invite link that was used by the user to send the join request
|
||||
pub invite_link: Option<ChatInviteLink>,
|
||||
}
|
|
@ -6,7 +6,7 @@ use std::{borrow::Cow, path::PathBuf};
|
|||
/// This object represents the contents of a file to be uploaded.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputfile).
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub enum InputFile {
|
||||
File(PathBuf),
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::types::{InputFile, MessageEntity, ParseMode};
|
|||
/// This object represents the content of a media message to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmedia).
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum InputMedia {
|
||||
|
@ -20,7 +20,7 @@ pub enum InputMedia {
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaphoto).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InputMediaPhoto {
|
||||
/// File to send.
|
||||
pub media: InputFile,
|
||||
|
@ -74,7 +74,7 @@ impl InputMediaPhoto {
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediavideo).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InputMediaVideo {
|
||||
// File to send.
|
||||
pub media: InputFile,
|
||||
|
@ -186,7 +186,7 @@ impl InputMediaVideo {
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaanimation).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InputMediaAnimation {
|
||||
/// File to send.
|
||||
pub media: InputFile,
|
||||
|
@ -288,7 +288,7 @@ impl InputMediaAnimation {
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaaudio).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InputMediaAudio {
|
||||
/// File to send.
|
||||
pub media: InputFile,
|
||||
|
@ -396,7 +396,7 @@ impl InputMediaAudio {
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediadocument).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct InputMediaDocument {
|
||||
/// File to send.
|
||||
pub media: InputFile,
|
||||
|
|
|
@ -3,7 +3,7 @@ use serde::Serialize;
|
|||
use crate::types::InputFile;
|
||||
|
||||
/// Sticker file that may be uploaded to telegram.
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize)]
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub enum InputSticker {
|
||||
/// PNG image with the sticker, must be up to 512 kilobytes in size,
|
||||
/// dimensions must not exceed 512px, and either width or height must be
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{
|
||||
CallbackQuery, Chat, ChatMemberUpdated, ChosenInlineResult, InlineQuery, Message, Poll,
|
||||
PollAnswer, PreCheckoutQuery, ShippingQuery, User,
|
||||
CallbackQuery, Chat, ChatJoinRequest, ChatMemberUpdated, ChosenInlineResult, InlineQuery,
|
||||
Message, Poll, PollAnswer, PreCheckoutQuery, ShippingQuery, User,
|
||||
};
|
||||
use serde_json::Value;
|
||||
|
||||
|
@ -108,6 +108,11 @@ pub enum UpdateKind {
|
|||
///
|
||||
/// [`AllowedUpdate::ChatMember`]: crate::types::AllowedUpdate::ChatMember
|
||||
ChatMember(ChatMemberUpdated),
|
||||
|
||||
/// A request to join the chat has been sent. The bot must have the
|
||||
/// can_invite_users administrator right in the chat to receive these
|
||||
/// updates.
|
||||
ChatJoinRequest(ChatJoinRequest),
|
||||
}
|
||||
|
||||
impl Update {
|
||||
|
|
Loading…
Add table
Reference in a new issue