Use ThreadId in methods

This commit is contained in:
Maybe Waffle 2023-06-05 15:55:21 +04:00
parent 14b3955f67
commit 4a041ac4e0
31 changed files with 129 additions and 106 deletions

View file

@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- MSRV (Minimal Supported Rust Version) was bumped from `1.64.0` to `1.65.0`
- Renamed `ForumTopic::message_thread_id` into `thread_id` ([#887][pr887])
- `ForumTopic::thread_id` and `Message::thread_id` now use `ThreadId` instead of `i32` ([#887][pr887])
- `message_thread_id` method parameters now use `ThreadId` instead of `i32` ([#887][pr887])
[pr852]: https://github.com/teloxide/teloxide/pull/853
[pr859]: https://github.com/teloxide/teloxide/pull/859

View file

@ -232,7 +232,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -311,7 +311,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -356,7 +356,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -440,7 +440,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -530,7 +530,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -635,7 +635,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -733,7 +733,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -849,7 +849,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -963,7 +963,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1048,7 +1048,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1131,7 +1131,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1181,7 +1181,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1449,7 +1449,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1548,7 +1548,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1627,7 +1627,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1746,7 +1746,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -1824,7 +1824,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread; supergroups only")
),
],
@ -2626,7 +2626,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: i32,
ty: RawTy("ThreadId"),
descr: Doc(md: "Unique identifier for the target message thread of the forum topic"),
),
Param(
@ -2655,7 +2655,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: i32,
ty: RawTy("ThreadId"),
descr: Doc(md: "Unique identifier for the target message thread of the forum topic"),
),
],
@ -2674,7 +2674,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: i32,
ty: RawTy("ThreadId"),
descr: Doc(md: "Unique identifier for the target message thread of the forum topic"),
),
],
@ -2693,7 +2693,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: i32,
ty: RawTy("ThreadId"),
descr: Doc(md: "Unique identifier for the target message thread of the forum topic"),
),
],
@ -2712,7 +2712,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: i32,
ty: RawTy("ThreadId"),
descr: Doc(md: "Unique identifier for the target message thread of the forum topic"),
),
],
@ -3411,7 +3411,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -3669,7 +3669,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
@ -4026,7 +4026,7 @@ Schema(
),
Param(
name: "message_thread_id",
ty: Option(i32),
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(

View file

@ -628,31 +628,31 @@ trait ErasableRequester<'a> {
fn edit_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, EditForumTopic, Self::Err>;
fn close_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, CloseForumTopic, Self::Err>;
fn reopen_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, ReopenForumTopic, Self::Err>;
fn delete_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, DeleteForumTopic, Self::Err>;
fn unpin_all_forum_topic_messages(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, UnpinAllForumTopicMessages, Self::Err>;
fn edit_general_forum_topic(
@ -1368,7 +1368,7 @@ where
fn edit_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, EditForumTopic, Self::Err> {
Requester::edit_forum_topic(self, chat_id, message_thread_id).erase()
}
@ -1376,7 +1376,7 @@ where
fn close_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, CloseForumTopic, Self::Err> {
Requester::close_forum_topic(self, chat_id, message_thread_id).erase()
}
@ -1384,7 +1384,7 @@ where
fn reopen_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, ReopenForumTopic, Self::Err> {
Requester::reopen_forum_topic(self, chat_id, message_thread_id).erase()
}
@ -1392,7 +1392,7 @@ where
fn delete_forum_topic(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, DeleteForumTopic, Self::Err> {
Requester::delete_forum_topic(self, chat_id, message_thread_id).erase()
}
@ -1400,7 +1400,7 @@ where
fn unpin_all_forum_topic_messages(
&self,
chat_id: Recipient,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> ErasedRequest<'a, UnpinAllForumTopicMessages, Self::Err> {
Requester::unpin_all_forum_topic_messages(self, chat_id, message_thread_id).erase()
}

View file

@ -6,7 +6,7 @@ use crate::{
requests::{JsonRequest, MultipartRequest},
types::{
BotCommand, ChatId, ChatPermissions, InlineQueryResult, InputFile, InputMedia,
InputSticker, LabeledPrice, MessageId, Recipient, UserId,
InputSticker, LabeledPrice, MessageId, Recipient, ThreadId, UserId,
},
Bot,
};
@ -671,7 +671,7 @@ impl Requester for Bot {
type EditForumTopic = JsonRequest<payloads::EditForumTopic>;
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::EditForumTopic
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::EditForumTopic
where
C: Into<Recipient>,
{
@ -683,7 +683,7 @@ impl Requester for Bot {
type CloseForumTopic = JsonRequest<payloads::CloseForumTopic>;
fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::CloseForumTopic
fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::CloseForumTopic
where
C: Into<Recipient>,
{
@ -695,7 +695,11 @@ impl Requester for Bot {
type ReopenForumTopic = JsonRequest<payloads::ReopenForumTopic>;
fn reopen_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::ReopenForumTopic
fn reopen_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: ThreadId,
) -> Self::ReopenForumTopic
where
C: Into<Recipient>,
{
@ -707,7 +711,11 @@ impl Requester for Bot {
type DeleteForumTopic = JsonRequest<payloads::DeleteForumTopic>;
fn delete_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::DeleteForumTopic
fn delete_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: ThreadId,
) -> Self::DeleteForumTopic
where
C: Into<Recipient>,
{
@ -722,7 +730,7 @@ impl Requester for Bot {
fn unpin_all_forum_topic_messages<C>(
&self,
chat_id: C,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> Self::UnpinAllForumTopicMessages
where
C: Into<Recipient>,

View file

@ -931,41 +931,41 @@ macro_rules! requester_forward {
(@method edit_forum_topic $body:ident $ty:ident) => {
type EditForumTopic = $ty![EditForumTopic];
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::EditForumTopic where C: Into<Recipient> {
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::EditForumTopic where C: Into<Recipient> {
let this = self;
$body!(edit_forum_topic this (chat_id: C, message_thread_id: i32))
$body!(edit_forum_topic this (chat_id: C, message_thread_id: ThreadId))
}
};
(@method close_forum_topic $body:ident $ty:ident) => {
type CloseForumTopic = $ty![CloseForumTopic];
fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::CloseForumTopic where C: Into<Recipient> {
fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::CloseForumTopic where C: Into<Recipient> {
let this = self;
$body!(close_forum_topic this (chat_id: C, message_thread_id: i32))
$body!(close_forum_topic this (chat_id: C, message_thread_id: ThreadId))
}
};
(@method reopen_forum_topic $body:ident $ty:ident) => {
type ReopenForumTopic = $ty![ReopenForumTopic];
fn reopen_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::ReopenForumTopic where C: Into<Recipient> {
fn reopen_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::ReopenForumTopic where C: Into<Recipient> {
let this = self;
$body!(reopen_forum_topic this (chat_id: C, message_thread_id: i32))
$body!(reopen_forum_topic this (chat_id: C, message_thread_id: ThreadId))
}
};
(@method delete_forum_topic $body:ident $ty:ident) => {
type DeleteForumTopic = $ty![DeleteForumTopic];
fn delete_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::DeleteForumTopic where C: Into<Recipient> {
fn delete_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::DeleteForumTopic where C: Into<Recipient> {
let this = self;
$body!(delete_forum_topic this (chat_id: C, message_thread_id: i32))
$body!(delete_forum_topic this (chat_id: C, message_thread_id: ThreadId))
}
};
(@method unpin_all_forum_topic_messages $body:ident $ty:ident) => {
type UnpinAllForumTopicMessages = $ty![UnpinAllForumTopicMessages];
fn unpin_all_forum_topic_messages<C>(&self, chat_id: C, message_thread_id: i32) -> Self::UnpinAllForumTopicMessages where C: Into<Recipient> {
fn unpin_all_forum_topic_messages<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::UnpinAllForumTopicMessages where C: Into<Recipient> {
let this = self;
$body!(unpin_all_forum_topic_messages this (chat_id: C, message_thread_id: i32))
$body!(unpin_all_forum_topic_messages this (chat_id: C, message_thread_id: ThreadId))
}
};
(@method edit_general_forum_topic $body:ident $ty:ident) => {

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Recipient, True};
use crate::types::{Recipient, ThreadId, True};
impl_payload! {
/// Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the _can\_manage\_topics_ administrator rights, unless it is the creator of the topic. Returns True on success.
@ -12,7 +12,7 @@ impl_payload! {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
}
}

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup};
use crate::types::{MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to copy messages of any kind. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the [`MessageId`] of the sent message on success.
@ -21,7 +21,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
pub caption: String [into],
/// Mode for parsing entities in the photo caption. See [formatting options] for more details.

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Recipient, True};
use crate::types::{Recipient, ThreadId, True};
impl_payload! {
/// Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the _can\_delete\_messages_ administrator rights. Returns True on success.
@ -12,7 +12,7 @@ impl_payload! {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
}
}

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Recipient, True};
use crate::types::{Recipient, ThreadId, True};
impl_payload! {
/// Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have _can\_manage\_topics_ administrator rights, unless it is the creator of the topic. Returns True on success.
@ -12,7 +12,7 @@ impl_payload! {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
optional {
/// Topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Message, MessageId, Recipient};
use crate::types::{Message, MessageId, Recipient, ThreadId};
impl_payload! {
/// Use this method to forward messages of any kind. On success, the sent [`Message`] is returned.
@ -21,7 +21,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Recipient, True};
use crate::types::{Recipient, ThreadId, True};
impl_payload! {
/// Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the _can\_manage\_topics_ administrator rights, unless it is the creator of the topic. Returns True on success.
@ -12,7 +12,7 @@ impl_payload! {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
}
}

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -23,7 +23,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Duration of the animation in seconds
pub duration: u32,
/// Animation width

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -26,7 +26,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Audio caption, 0-1024 characters after entities parsing
pub caption: String [into],
/// Mode for parsing entities in the audio caption. See [formatting options] for more details.

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{ChatAction, Recipient, True};
use crate::types::{ChatAction, Recipient, ThreadId, True};
impl_payload! {
/// Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
@ -31,7 +31,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread; supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
}
}

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Message, MessageId, Recipient, ReplyMarkup};
use crate::types::{Message, MessageId, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to send phone contacts. On success, the sent [`Message`] is returned.
@ -20,7 +20,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Contact's last name
pub last_name: String [into],
/// Additional data about the contact in the form of a [vCard], 0-2048 bytes

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{DiceEmoji, Message, MessageId, Recipient, ReplyMarkup};
use crate::types::{DiceEmoji, Message, MessageId, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to send an animated emoji that will display a random value. On success, the sent [`Message`] is returned.
@ -16,7 +16,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”
pub emoji: DiceEmoji,
/// Sends the message [silently]. Users will receive a notification with no sound.

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -23,7 +23,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]
///
/// [More info on Sending Files »]: crate::types::InputFile

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Message, ReplyMarkup};
use crate::types::{Message, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to send a game. On success, the sent [`Message`] is returned.
@ -18,7 +18,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use url::Url;
use crate::types::{InlineKeyboardMarkup, LabeledPrice, Message, Recipient};
use crate::types::{InlineKeyboardMarkup, LabeledPrice, Message, Recipient, ThreadId};
impl_payload! {
/// Use this method to send invoices. On success, the sent [`Message`] is returned.
@ -31,7 +31,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of `US$ 1.45` pass `max_tip_amount = 145`. See the exp parameter in [`currencies.json`], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0
///
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Message, MessageId, Recipient, ReplyMarkup};
use crate::types::{Message, MessageId, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to send point on the map. On success, the sent [`Message`] is returned.
@ -20,7 +20,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// The radius of uncertainty for the location, measured in meters; 0-1500
pub horizontal_accuracy: f64,
/// Period in seconds for which the location will be updated (see [Live Locations], should be between 60 and 86400.

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{InputMedia, Message, MessageId, Recipient};
use crate::types::{InputMedia, Message, MessageId, Recipient, ThreadId};
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.
@ -18,7 +18,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages

View file

@ -2,7 +2,9 @@
use serde::Serialize;
use crate::types::{Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup};
use crate::types::{
Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
/// Use this method to send text messages. On success, the sent [`Message`] is returned.
@ -18,7 +20,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Mode for parsing entities in the message text. See [formatting options] for more details.
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -23,7 +23,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Photo caption (may also be used when resending photos by _file\_id_), 0-1024 characters after entities parsing
pub caption: String [into],
/// Mode for parsing entities in the photo caption. See [formatting options] for more details.

View file

@ -4,7 +4,7 @@ use chrono::{DateTime, Utc};
use serde::Serialize;
use crate::types::{
Message, MessageEntity, MessageId, ParseMode, PollType, Recipient, ReplyMarkup,
Message, MessageEntity, MessageId, ParseMode, PollType, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -23,7 +23,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// True, if the poll needs to be anonymous, defaults to True
pub is_anonymous: bool,
/// Poll type, “quiz” or “regular”, defaults to “regular”

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{InputFile, Message, Recipient, ReplyMarkup};
use crate::types::{InputFile, Message, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
@[multipart = sticker]
@ -21,7 +21,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Message, MessageId, Recipient, ReplyMarkup};
use crate::types::{Message, MessageId, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
/// Use this method to send information about a venue. On success, the sent [`Message`] is returned.
@ -24,7 +24,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Foursquare identifier of the venue
pub foursquare_id: String [into],
/// Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -24,7 +24,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Duration of the video in seconds
pub duration: u32,
/// Video width

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{InputFile, Message, MessageId, Recipient, ReplyMarkup};
use crate::types::{InputFile, Message, MessageId, Recipient, ReplyMarkup, ThreadId};
impl_payload! {
@[multipart = video_note, thumb]
@ -22,7 +22,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Duration of the video in seconds
pub duration: u32,
/// Video width and height, i.e. diameter of the video message

View file

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::types::{
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup,
InputFile, Message, MessageEntity, MessageId, ParseMode, Recipient, ReplyMarkup, ThreadId,
};
impl_payload! {
@ -25,7 +25,7 @@ impl_payload! {
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
/// Voice message caption, 0-1024 characters after entities parsing
pub caption: String [into],
/// Mode for parsing entities in the voice message caption. See [formatting options] for more details.

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::types::{Recipient, True};
use crate::types::{Recipient, ThreadId, True};
impl_payload! {
/// Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the _can\_pin\_messages_ administrator right in the supergroup. Returns True on success.
@ -12,7 +12,7 @@ impl_payload! {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i32,
pub message_thread_id: ThreadId,
}
}
}

View file

@ -678,28 +678,40 @@ pub trait Requester {
type EditForumTopic: Request<Payload = EditForumTopic, Err = Self::Err>;
/// For Telegram documentation see [`EditForumTopic`].
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::EditForumTopic
fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::EditForumTopic
where
C: Into<Recipient>;
type CloseForumTopic: Request<Payload = CloseForumTopic, Err = Self::Err>;
/// For Telegram documentation see [`CloseForumTopic`].
fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::CloseForumTopic
fn close_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: ThreadId,
) -> Self::CloseForumTopic
where
C: Into<Recipient>;
type ReopenForumTopic: Request<Payload = ReopenForumTopic, Err = Self::Err>;
/// For Telegram documentation see [`ReopenForumTopic`].
fn reopen_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::ReopenForumTopic
fn reopen_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: ThreadId,
) -> Self::ReopenForumTopic
where
C: Into<Recipient>;
type DeleteForumTopic: Request<Payload = DeleteForumTopic, Err = Self::Err>;
/// For Telegram documentation see [`DeleteForumTopic`].
fn delete_forum_topic<C>(&self, chat_id: C, message_thread_id: i32) -> Self::DeleteForumTopic
fn delete_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: ThreadId,
) -> Self::DeleteForumTopic
where
C: Into<Recipient>;
@ -709,7 +721,7 @@ pub trait Requester {
fn unpin_all_forum_topic_messages<C>(
&self,
chat_id: C,
message_thread_id: i32,
message_thread_id: ThreadId,
) -> Self::UnpinAllForumTopicMessages
where
C: Into<Recipient>;