mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Merge pull request #211 from teloxide/r060
Release `teloxide-core` 0.6.0
This commit is contained in:
commit
57122b7533
12 changed files with 46 additions and 39 deletions
|
@ -7,20 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## unreleased
|
## unreleased
|
||||||
|
|
||||||
|
## 0.6.0 - 2022-04-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Support for Telegram Bot API [version 6.0](https://core.telegram.org/bots/api#april-16-2022)
|
- Support for Telegram Bot API [version 6.0](https://core.telegram.org/bots/api#april-16-2022) ([#206][pr206], [#211][pr211])
|
||||||
- Note that some field were renamed
|
- Note that some field were renamed
|
||||||
- Shortcut methods for `MessageEntity` ([#208][pr208], [#210][pr210])
|
- Shortcut methods for `MessageEntity` ([#208][pr208], [#210][pr210])
|
||||||
|
|
||||||
[pr208]: https://github.com/teloxide/teloxide-core/pull/208
|
[pr208]: https://github.com/teloxide/teloxide-core/pull/208
|
||||||
|
[pr206]: https://github.com/teloxide/teloxide-core/pull/206
|
||||||
[pr210]: https://github.com/teloxide/teloxide-core/pull/210
|
[pr210]: https://github.com/teloxide/teloxide-core/pull/210
|
||||||
|
[pr211]: https://github.com/teloxide/teloxide-core/pull/211
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Make `KeyboardMarkup` creation more convenient ([#207][pr207])
|
||||||
- Accept `IntoIterator` in `KeyboardMarkup::append_row`.
|
- Accept `IntoIterator` in `KeyboardMarkup::append_row`.
|
||||||
- Accept `Into<String>` instead of `String` in `InlineKeyboardButton::{url, callback, switch_inline_query, switch_inline_query_current_chat}`.
|
- Accept `Into<String>` instead of `String` in `InlineKeyboardButton::{url, callback, switch_inline_query, switch_inline_query_current_chat}`.
|
||||||
|
|
||||||
|
[pr207]: https://github.com/teloxide/teloxide-core/pull/207
|
||||||
|
|
||||||
## 0.5.1 - 2022-04-18
|
## 0.5.1 - 2022-04-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "teloxide-core"
|
name = "teloxide-core"
|
||||||
description = "Core part of the `teloxide` library - telegram bot API client"
|
description = "Core part of the `teloxide` library - telegram bot API client"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
teloxide-core = "0.5"
|
teloxide-core = "0.6"
|
||||||
```
|
```
|
||||||
_Compiler support: requires rustc 1.58+_.
|
_Compiler support: requires rustc 1.58+_.
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! asynchronous and built using [`tokio`].
|
//! asynchronous and built using [`tokio`].
|
||||||
//!
|
//!
|
||||||
//!```toml
|
//!```toml
|
||||||
//! teloxide_core = "0.5"
|
//! teloxide_core = "0.6"
|
||||||
//! ```
|
//! ```
|
||||||
//! _Compiler support: requires rustc 1.58+_.
|
//! _Compiler support: requires rustc 1.58+_.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl_payload! {
|
||||||
pub can_edit_messages: bool,
|
pub can_edit_messages: bool,
|
||||||
/// Pass True, if the administrator can delete messages of other users
|
/// Pass True, if the administrator can delete messages of other users
|
||||||
pub can_delete_messages: bool,
|
pub can_delete_messages: bool,
|
||||||
/// Pass True, if the administrator can manage voice chats, supergroups only
|
/// Pass True, if the administrator can manage video chats, supergroups only
|
||||||
pub can_manage_video_chats: bool,
|
pub can_manage_video_chats: bool,
|
||||||
/// Pass True, if the administrator can invite new users to the chat
|
/// Pass True, if the administrator can invite new users to the chat
|
||||||
pub can_invite_users: bool,
|
pub can_invite_users: bool,
|
||||||
|
|
16
src/types.rs
16
src/types.rs
|
@ -100,12 +100,12 @@ pub use user::*;
|
||||||
pub use user_profile_photos::*;
|
pub use user_profile_photos::*;
|
||||||
pub use venue::*;
|
pub use venue::*;
|
||||||
pub use video::*;
|
pub use video::*;
|
||||||
|
pub use video_chat_ended::*;
|
||||||
|
pub use video_chat_participants_invited::*;
|
||||||
|
pub use video_chat_scheduled::*;
|
||||||
|
pub use video_chat_started::*;
|
||||||
pub use video_note::*;
|
pub use video_note::*;
|
||||||
pub use voice::*;
|
pub use voice::*;
|
||||||
pub use voice_chat_ended::*;
|
|
||||||
pub use voice_chat_participants_invited::*;
|
|
||||||
pub use voice_chat_scheduled::*;
|
|
||||||
pub use voice_chat_started::*;
|
|
||||||
pub use web_app_data::*;
|
pub use web_app_data::*;
|
||||||
pub use web_app_info::*;
|
pub use web_app_info::*;
|
||||||
pub use webhook_info::*;
|
pub use webhook_info::*;
|
||||||
|
@ -183,12 +183,12 @@ mod user;
|
||||||
mod user_profile_photos;
|
mod user_profile_photos;
|
||||||
mod venue;
|
mod venue;
|
||||||
mod video;
|
mod video;
|
||||||
|
mod video_chat_ended;
|
||||||
|
mod video_chat_participants_invited;
|
||||||
|
mod video_chat_scheduled;
|
||||||
|
mod video_chat_started;
|
||||||
mod video_note;
|
mod video_note;
|
||||||
mod voice;
|
mod voice;
|
||||||
mod voice_chat_ended;
|
|
||||||
mod voice_chat_participants_invited;
|
|
||||||
mod voice_chat_scheduled;
|
|
||||||
mod voice_chat_started;
|
|
||||||
mod web_app_data;
|
mod web_app_data;
|
||||||
mod web_app_info;
|
mod web_app_info;
|
||||||
mod webhook_info;
|
mod webhook_info;
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub struct Administrator {
|
||||||
/// `true` if the administrator can delete messages of other users.
|
/// `true` if the administrator can delete messages of other users.
|
||||||
pub can_delete_messages: bool,
|
pub can_delete_messages: bool,
|
||||||
|
|
||||||
/// `true` if the administrator can manage voice chats.
|
/// `true` if the administrator can manage video chats.
|
||||||
pub can_manage_video_chats: bool,
|
pub can_manage_video_chats: bool,
|
||||||
|
|
||||||
/// `true` if the administrator can invite new users to the chat.
|
/// `true` if the administrator can invite new users to the chat.
|
||||||
|
@ -394,15 +394,15 @@ impl ChatMemberKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the user can manage voice chats.
|
/// Returns `true` if the user can manage video chats.
|
||||||
///
|
///
|
||||||
/// I.e. returns `true` if the user
|
/// I.e. returns `true` if the user
|
||||||
/// - is the owner of the chat
|
/// - is the owner of the chat
|
||||||
/// - is an administrator in the given chat and has the
|
/// - is an administrator in the given chat and has the
|
||||||
/// [`can_manage_voice_chats`] privilege.
|
/// [`can_manage_video_chats`] privilege.
|
||||||
/// Returns `false` otherwise.
|
/// Returns `false` otherwise.
|
||||||
///
|
///
|
||||||
/// [`can_manage_voice_chats`]: Administrator::can_manage_voice_chats
|
/// [`can_manage_video_chats`]: Administrator::can_manage_video_chats
|
||||||
pub fn can_manage_video_chats(&self) -> bool {
|
pub fn can_manage_video_chats(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::Owner(_) => true,
|
Self::Owner(_) => true,
|
||||||
|
|
|
@ -54,10 +54,10 @@ pub enum MessageKind {
|
||||||
PassportData(MessagePassportData),
|
PassportData(MessagePassportData),
|
||||||
Dice(MessageDice),
|
Dice(MessageDice),
|
||||||
ProximityAlertTriggered(MessageProximityAlertTriggered),
|
ProximityAlertTriggered(MessageProximityAlertTriggered),
|
||||||
VoiceChatScheduled(MessageVoiceChatScheduled),
|
VideoChatScheduled(MessageVideoChatScheduled),
|
||||||
VoiceChatStarted(MessageVoiceChatStarted),
|
VideoChatStarted(MessageVideoChatStarted),
|
||||||
VoiceChatEnded(MessageVoiceChatEnded),
|
VideoChatEnded(MessageVideoChatEnded),
|
||||||
VoiceChatParticipantsInvited(MessageVoiceChatParticipantsInvited),
|
VideoChatParticipantsInvited(MessageVideoChatParticipantsInvited),
|
||||||
WebAppData(MessageWebAppData),
|
WebAppData(MessageWebAppData),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,26 +493,26 @@ pub struct MessageProximityAlertTriggered {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MessageVoiceChatScheduled {
|
pub struct MessageVideoChatScheduled {
|
||||||
/// Service message: voice chat scheduled
|
/// Service message: video chat scheduled
|
||||||
pub video_chat_scheduled: VideoChatScheduled,
|
pub video_chat_scheduled: VideoChatScheduled,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MessageVoiceChatStarted {
|
pub struct MessageVideoChatStarted {
|
||||||
/// Service message: voice chat started.
|
/// Service message: video chat started.
|
||||||
pub video_chat_started: VideoChatStarted,
|
pub video_chat_started: VideoChatStarted,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MessageVoiceChatEnded {
|
pub struct MessageVideoChatEnded {
|
||||||
/// Service message: voice chat ended.
|
/// Service message: video chat ended.
|
||||||
pub video_chat_ended: VideoChatEnded,
|
pub video_chat_ended: VideoChatEnded,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MessageVoiceChatParticipantsInvited {
|
pub struct MessageVideoChatParticipantsInvited {
|
||||||
/// Service message: new participants invited to a voice chat.
|
/// Service message: new participants invited to a video chat.
|
||||||
pub video_chat_participants_invited: VideoChatParticipantsInvited,
|
pub video_chat_participants_invited: VideoChatParticipantsInvited,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1466,7 +1466,7 @@ mod tests {
|
||||||
|
|
||||||
let message: Message = serde_json::from_str(json).unwrap();
|
let message: Message = serde_json::from_str(json).unwrap();
|
||||||
|
|
||||||
assert!(matches!(message.kind, MessageKind::VoiceChatStarted { .. }));
|
assert!(matches!(message.kind, MessageKind::VideoChatStarted { .. }));
|
||||||
|
|
||||||
// FIXME(waffle): it seems like we are losing `sender_chat` in some
|
// FIXME(waffle): it seems like we are losing `sender_chat` in some
|
||||||
// cases inclusing this
|
// cases inclusing this
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// This object represents a service message about a voice chat ended in the
|
/// This object represents a service message about a video chat ended in the
|
||||||
/// chat.
|
/// chat.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VideoChatEnded {}
|
pub struct VideoChatEnded {}
|
|
@ -3,9 +3,9 @@ use serde::{Deserialize, Serialize};
|
||||||
use crate::types::User;
|
use crate::types::User;
|
||||||
|
|
||||||
/// This object represents a service message about new members invited to a
|
/// This object represents a service message about new members invited to a
|
||||||
/// voice chat.
|
/// video chat.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VideoChatParticipantsInvited {
|
pub struct VideoChatParticipantsInvited {
|
||||||
/// New members that were invited to the voice chat
|
/// New members that were invited to the video chat
|
||||||
pub users: Option<Vec<User>>,
|
pub users: Option<Vec<User>>,
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// This object represents a service message about a voice chat scheduled in the
|
/// This object represents a service message about a video chat scheduled in the
|
||||||
/// chat.
|
/// chat.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VideoChatScheduled {
|
pub struct VideoChatScheduled {
|
||||||
/// Point in time when the voice chat is supposed to be started by a chat
|
/// Point in time when the video chat is supposed to be started by a chat
|
||||||
/// administrator.
|
/// administrator.
|
||||||
#[serde(with = "crate::types::serde_date_from_unix_timestamp")]
|
#[serde(with = "crate::types::serde_date_from_unix_timestamp")]
|
||||||
pub start_date: DateTime<Utc>,
|
pub start_date: DateTime<Utc>,
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// This object represents a service message about a voice chat started in the
|
/// This object represents a service message about a video chat started in the
|
||||||
/// chat. Currently holds no information.
|
/// chat. Currently holds no information.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VideoChatStarted {}
|
pub struct VideoChatStarted {}
|
Loading…
Reference in a new issue