From a833bd89adbe1ebe10dc94c6dff8cc10bc1deec1 Mon Sep 17 00:00:00 2001 From: Andrey Brusnik Date: Mon, 19 Aug 2024 16:26:11 +0400 Subject: [PATCH] Change `options` param type in method `sendPoll` to `InputPollOption` --- crates/teloxide-core/schema.ron | 4 ++-- crates/teloxide-core/src/adaptors/erased.rs | 4 ++-- crates/teloxide-core/src/bot/api.rs | 6 +++--- crates/teloxide-core/src/local_macros.rs | 2 +- crates/teloxide-core/src/payloads/send_poll.rs | 8 ++++---- crates/teloxide-core/src/requests/requester.rs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 4c50055a..d7044751 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -1752,8 +1752,8 @@ Schema( ), Param( name: "options", - ty: ArrayOf(String), - descr: Doc(md: "A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"), + ty: ArrayOf(RawTy("InputPollOption")), + descr: Doc(md: "A JSON-serialized list of 2-10 answer options"), ), Param( name: "is_anonymous", diff --git a/crates/teloxide-core/src/adaptors/erased.rs b/crates/teloxide-core/src/adaptors/erased.rs index 1e0728a4..3d97f591 100644 --- a/crates/teloxide-core/src/adaptors/erased.rs +++ b/crates/teloxide-core/src/adaptors/erased.rs @@ -473,7 +473,7 @@ trait ErasableRequester<'a> { &self, chat_id: Recipient, question: String, - options: Vec, + options: Vec, ) -> ErasedRequest<'a, SendPoll, Self::Err>; fn send_dice(&self, chat_id: Recipient) -> ErasedRequest<'a, SendDice, Self::Err>; @@ -1234,7 +1234,7 @@ where &self, chat_id: Recipient, question: String, - options: Vec, + options: Vec, ) -> ErasedRequest<'a, SendPoll, Self::Err> { Requester::send_poll(self, chat_id, question, options).erase() } diff --git a/crates/teloxide-core/src/bot/api.rs b/crates/teloxide-core/src/bot/api.rs index 7fed7fc5..e87f62cb 100644 --- a/crates/teloxide-core/src/bot/api.rs +++ b/crates/teloxide-core/src/bot/api.rs @@ -6,8 +6,8 @@ use crate::{ requests::{JsonRequest, MultipartRequest}, types::{ BotCommand, BusinessConnectionId, ChatId, ChatPermissions, InlineQueryResult, InputFile, - InputMedia, InputSticker, LabeledPrice, MessageId, Recipient, Rgb, StickerFormat, ThreadId, - UserId, + InputMedia, InputPollOption, InputSticker, LabeledPrice, MessageId, Recipient, Rgb, + StickerFormat, ThreadId, UserId, }, Bot, }; @@ -283,7 +283,7 @@ impl Requester for Bot { where C: Into, Q: Into, - O: IntoIterator, + O: IntoIterator, { Self::SendPoll::new(self.clone(), payloads::SendPoll::new(chat_id, question, options)) } diff --git a/crates/teloxide-core/src/local_macros.rs b/crates/teloxide-core/src/local_macros.rs index a6d2abbf..95a1c042 100644 --- a/crates/teloxide-core/src/local_macros.rs +++ b/crates/teloxide-core/src/local_macros.rs @@ -646,7 +646,7 @@ macro_rules! requester_forward { fn send_poll(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll where C: Into, Q: Into, - O: IntoIterator { + O: IntoIterator { let this = self; $body!(send_poll this (chat_id: C, question: Q, options: O)) } diff --git a/crates/teloxide-core/src/payloads/send_poll.rs b/crates/teloxide-core/src/payloads/send_poll.rs index 56b1931e..90db1462 100644 --- a/crates/teloxide-core/src/payloads/send_poll.rs +++ b/crates/teloxide-core/src/payloads/send_poll.rs @@ -4,8 +4,8 @@ use chrono::{DateTime, Utc}; use serde::Serialize; use crate::types::{ - BusinessConnectionId, Message, MessageEntity, ParseMode, PollType, Recipient, ReplyMarkup, - ReplyParameters, ThreadId, + BusinessConnectionId, InputPollOption, Message, MessageEntity, ParseMode, PollType, Recipient, + ReplyMarkup, ReplyParameters, ThreadId, }; impl_payload! { @@ -19,8 +19,8 @@ impl_payload! { pub chat_id: Recipient [into], /// Poll question, 1-300 characters pub question: String [into], - /// A JSON-serialized list of answer options, 2-10 strings 1-100 characters each - pub options: Vec [collect], + /// A JSON-serialized list of 2-10 answer options + pub options: Vec [collect], } optional { /// Unique identifier of the business connection on behalf of which the message will be sent diff --git a/crates/teloxide-core/src/requests/requester.rs b/crates/teloxide-core/src/requests/requester.rs index a758f167..3dedae89 100644 --- a/crates/teloxide-core/src/requests/requester.rs +++ b/crates/teloxide-core/src/requests/requester.rs @@ -397,7 +397,7 @@ pub trait Requester { where C: Into, Q: Into, - O: IntoIterator; + O: IntoIterator; type SendDice: Request;