mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-13 11:18:17 +01:00
Add TBA 5.4 types
This commit is contained in:
parent
094211e6a1
commit
8002f98ef7
4 changed files with 36 additions and 2 deletions
|
@ -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>,
|
||||
}
|
|
@ -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