mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Don't clone a bot while cloning a request
This commit is contained in:
parent
6c1a39570c
commit
0232108822
66 changed files with 332 additions and 199 deletions
|
@ -5,14 +5,15 @@ use crate::{
|
|||
Bot,
|
||||
};
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
|
||||
/// Use this method to add a new sticker to a set created by the bot.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#addstickertoset).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct AddStickerToSet<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
user_id: i32,
|
||||
name: String,
|
||||
png_sticker: InputFile,
|
||||
|
@ -59,7 +60,7 @@ impl<'a> AddStickerToSet<'a> {
|
|||
E: Into<String>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
user_id,
|
||||
name: name.into(),
|
||||
png_sticker,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -17,10 +18,10 @@ use crate::{
|
|||
///
|
||||
/// [inline keyboards]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct AnswerCallbackQuery<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
callback_query_id: String,
|
||||
text: Option<String>,
|
||||
show_alert: Option<bool>,
|
||||
|
@ -50,7 +51,7 @@ impl<'a> AnswerCallbackQuery<'a> {
|
|||
{
|
||||
let callback_query_id = callback_query_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
callback_query_id,
|
||||
text: None,
|
||||
show_alert: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -13,10 +14,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#answerinlinequery).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct AnswerInlineQuery<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
inline_query_id: String,
|
||||
results: Vec<InlineQueryResult>,
|
||||
cache_time: Option<i32>,
|
||||
|
@ -54,7 +55,7 @@ impl<'a> AnswerInlineQuery<'a> {
|
|||
let inline_query_id = inline_query_id.into();
|
||||
let results = results.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
inline_query_id,
|
||||
results,
|
||||
cache_time: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -17,10 +18,10 @@ use crate::{
|
|||
///
|
||||
/// [`Update`]: crate::types::Update
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct AnswerPreCheckoutQuery<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
pre_checkout_query_id: String,
|
||||
ok: bool,
|
||||
error_message: Option<String>,
|
||||
|
@ -52,7 +53,7 @@ impl<'a> AnswerPreCheckoutQuery<'a> {
|
|||
{
|
||||
let pre_checkout_query_id = pre_checkout_query_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
pre_checkout_query_id,
|
||||
ok,
|
||||
error_message: None,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ShippingOption, True},
|
||||
Bot,
|
||||
};
|
||||
|
||||
/// If you sent an invoice requesting a shipping address and the parameter
|
||||
/// `is_flexible` was specified, the Bot API will send an [`Update`] with a
|
||||
/// shipping_query field to the bot. Use this method to reply to shipping
|
||||
|
@ -16,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [`Update`]: crate::types::Update
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct AnswerShippingQuery<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
shipping_query_id: String,
|
||||
ok: bool,
|
||||
shipping_options: Option<Vec<ShippingOption>>,
|
||||
|
@ -48,7 +48,7 @@ impl<'a> AnswerShippingQuery<'a> {
|
|||
{
|
||||
let shipping_query_id = shipping_query_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
shipping_query_id,
|
||||
ok,
|
||||
shipping_options: None,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -9,9 +10,9 @@ use crate::{
|
|||
/// able to edit the created sticker set.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#createnewstickerset).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct CreateNewStickerSet<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
user_id: i32,
|
||||
name: String,
|
||||
title: String,
|
||||
|
@ -66,7 +67,7 @@ impl<'a> CreateNewStickerSet<'a> {
|
|||
E: Into<String>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
user_id,
|
||||
name: name.into(),
|
||||
title: title.into(),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -13,10 +14,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#deletechatphoto).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct DeleteChatPhoto<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,10 @@ impl<'a> DeleteChatPhoto<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target channel
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -18,10 +19,10 @@ use crate::{
|
|||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct DeleteChatStickerSet<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,10 @@ impl<'a> DeleteChatStickerSet<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -23,10 +24,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#deletemessage).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct DeleteMessage<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
message_id: i32,
|
||||
}
|
||||
|
@ -53,7 +54,7 @@ impl<'a> DeleteMessage<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
message_id,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#deletestickerfromset).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct DeleteStickerFromSet<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
sticker: String,
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,10 @@ impl<'a> DeleteStickerFromSet<'a> {
|
|||
S: Into<String>,
|
||||
{
|
||||
let sticker = sticker.into();
|
||||
Self { bot, sticker }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
sticker,
|
||||
}
|
||||
}
|
||||
|
||||
/// File identifier of the sticker.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,16 +15,17 @@ use crate::{
|
|||
///
|
||||
/// [Bot::get_updates]: crate::Bot::get_updates
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Copy, Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct DeleteWebhook<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Request for DeleteWebhook<'_> {
|
||||
type Output = True;
|
||||
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
async fn send(&self) -> ResponseResult<True> {
|
||||
network::request_json(
|
||||
self.bot.client(),
|
||||
|
@ -37,6 +39,8 @@ impl Request for DeleteWebhook<'_> {
|
|||
|
||||
impl<'a> DeleteWebhook<'a> {
|
||||
pub(crate) fn new(bot: &'a Bot) -> Self {
|
||||
Self { bot }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -17,10 +18,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct EditMessageCaption<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
caption: Option<String>,
|
||||
|
@ -49,7 +50,7 @@ impl<'a> EditMessageCaption<'a> {
|
|||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
caption: None,
|
||||
parse_mode: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -19,10 +20,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct EditMessageLiveLocation<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
latitude: f32,
|
||||
|
@ -53,7 +54,7 @@ impl<'a> EditMessageLiveLocation<'a> {
|
|||
longitude: f32,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
latitude,
|
||||
longitude,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -19,9 +20,9 @@ use crate::{
|
|||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct EditMessageMedia<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
media: InputMedia,
|
||||
reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
@ -73,7 +74,7 @@ impl<'a> EditMessageMedia<'a> {
|
|||
media: InputMedia,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
media,
|
||||
reply_markup: None,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatOrInlineMessage, InlineKeyboardMarkup, Message},
|
||||
Bot,
|
||||
};
|
||||
|
||||
/// Use this method to edit only the reply markup of messages.
|
||||
///
|
||||
/// On success, if edited message is sent by the bot, the edited [`Message`] is
|
||||
|
@ -17,10 +17,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct EditMessageReplyMarkup<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
@ -47,7 +47,7 @@ impl<'a> EditMessageReplyMarkup<'a> {
|
|||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
reply_markup: None,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -17,10 +18,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct EditMessageText<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
text: String,
|
||||
|
@ -54,7 +55,7 @@ impl<'a> EditMessageText<'a> {
|
|||
T: Into<String>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
text: text.into(),
|
||||
parse_mode: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -27,10 +28,10 @@ use crate::{
|
|||
/// [`Bot::export_chat_invite_link`]: crate::Bot::export_chat_invite_link
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct ExportChatInviteLink<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -56,7 +57,10 @@ impl<'a> ExportChatInviteLink<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target channel
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [`The official docs`](https://core.telegram.org/bots/api#forwardmessage).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct ForwardMessage<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
from_chat_id: ChatId,
|
||||
disable_notification: Option<bool>,
|
||||
|
@ -50,7 +51,7 @@ impl<'a> ForwardMessage<'a> {
|
|||
let chat_id = chat_id.into();
|
||||
let from_chat_id = from_chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
from_chat_id,
|
||||
message_id,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -13,10 +14,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getchat).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetChat<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,10 @@ impl<'a> GetChat<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getchatadministrators).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetChatAdministrators<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,10 @@ impl<'a> GetChatAdministrators<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getchatmember).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetChatMember<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ impl<'a> GetChatMember<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getchatmemberscount).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetChatMembersCount<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,10 @@ impl<'a> GetChatMembersCount<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -27,10 +28,10 @@ use crate::{
|
|||
/// [`File`]: crate::types::file
|
||||
/// [`GetFile`]: self::GetFile
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetFile<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
file_id: String,
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ impl<'a> GetFile<'a> {
|
|||
F: Into<String>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
file_id: file_id.into(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -20,10 +21,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getgamehighscores).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetGameHighScores<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
user_id: i32,
|
||||
|
@ -51,7 +52,7 @@ impl<'a> GetGameHighScores<'a> {
|
|||
user_id: i32,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
user_id,
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -9,10 +10,10 @@ use serde::Serialize;
|
|||
/// A simple method for testing your bot's auth token. Requires no parameters.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getme).
|
||||
#[derive(Debug, Clone, Copy, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Copy, Serialize)]
|
||||
pub struct GetMe<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
@ -34,6 +35,8 @@ impl Request for GetMe<'_> {
|
|||
|
||||
impl<'a> GetMe<'a> {
|
||||
pub(crate) fn new(bot: &'a Bot) -> Self {
|
||||
Self { bot }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getstickerset).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetStickerSet<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
name: String,
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,10 @@ impl<'a> GetStickerSet<'a> {
|
|||
N: Into<String>,
|
||||
{
|
||||
let name = name.into();
|
||||
Self { bot, name }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
name,
|
||||
}
|
||||
}
|
||||
|
||||
/// Name of the sticker set.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -18,10 +19,10 @@ use crate::{
|
|||
///
|
||||
/// [wiki]: https://en.wikipedia.org/wiki/Push_technology#Long_polling
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetUpdates<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
pub(crate) offset: Option<i32>,
|
||||
pub(crate) limit: Option<u8>,
|
||||
pub(crate) timeout: Option<u32>,
|
||||
|
@ -46,7 +47,7 @@ impl Request for GetUpdates<'_> {
|
|||
impl<'a> GetUpdates<'a> {
|
||||
pub(crate) fn new(bot: &'a Bot) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
offset: None,
|
||||
limit: None,
|
||||
timeout: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#getuserprofilephotos).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Copy, Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetUserProfilePhotos<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
user_id: i32,
|
||||
offset: Option<i32>,
|
||||
limit: Option<i32>,
|
||||
|
@ -38,7 +39,7 @@ impl Request for GetUserProfilePhotos<'_> {
|
|||
impl<'a> GetUserProfilePhotos<'a> {
|
||||
pub(crate) fn new(bot: &'a Bot, user_id: i32) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
user_id,
|
||||
offset: None,
|
||||
limit: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,16 +16,17 @@ use crate::{
|
|||
/// [The official docs](https://core.telegram.org/bots/api#getwebhookinfo).
|
||||
///
|
||||
/// [`Bot::get_updates`]: crate::Bot::get_updates
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Copy, Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct GetWebhookInfo<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Request for GetWebhookInfo<'_> {
|
||||
type Output = WebhookInfo;
|
||||
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
async fn send(&self) -> ResponseResult<WebhookInfo> {
|
||||
network::request_json(
|
||||
self.bot.client(),
|
||||
|
@ -38,6 +40,8 @@ impl Request for GetWebhookInfo<'_> {
|
|||
|
||||
impl<'a> GetWebhookInfo<'a> {
|
||||
pub(crate) fn new(bot: &'a Bot) -> Self {
|
||||
Self { bot }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -18,10 +19,10 @@ use crate::{
|
|||
///
|
||||
/// [unbanned]: crate::Bot::unban_chat_member
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct KickChatMember<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
until_date: Option<i32>,
|
||||
|
@ -49,7 +50,7 @@ impl<'a> KickChatMember<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
until_date: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#leavechat).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct LeaveChat<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,10 @@ impl<'a> LeaveChat<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target
|
||||
|
|
|
@ -64,6 +64,7 @@ mod unban_chat_member;
|
|||
mod unpin_chat_message;
|
||||
mod upload_sticker_file;
|
||||
|
||||
use crate::Bot;
|
||||
pub use add_sticker_to_set::*;
|
||||
pub use answer_callback_query::*;
|
||||
pub use answer_inline_query::*;
|
||||
|
@ -124,9 +125,41 @@ pub use set_chat_title::*;
|
|||
pub use set_game_score::*;
|
||||
pub use set_sticker_position_in_set::*;
|
||||
pub use set_webhook::*;
|
||||
use std::ops::Deref;
|
||||
pub use std::pin::Pin;
|
||||
pub use stop_message_live_location::*;
|
||||
pub use stop_poll::*;
|
||||
pub use unban_chat_member::*;
|
||||
pub use unpin_chat_message::*;
|
||||
pub use upload_sticker_file::*;
|
||||
|
||||
/// A wrapper that implements `Clone`, Copy, `PartialEq`, `Eq`, `Debug`, but
|
||||
/// performs no copying, cloning and comparison.
|
||||
///
|
||||
/// Used in the requests bodies.
|
||||
#[derive(Debug)]
|
||||
struct BotWrapper<'a>(&'a Bot);
|
||||
|
||||
impl PartialEq for BotWrapper<'_> {
|
||||
fn eq(&self, _: &BotWrapper<'_>) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for BotWrapper<'_> {}
|
||||
|
||||
impl<'a> Clone for BotWrapper<'a> {
|
||||
fn clone(&self) -> BotWrapper<'a> {
|
||||
Self(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Copy for BotWrapper<'_> {}
|
||||
|
||||
impl Deref for BotWrapper<'_> {
|
||||
type Target = Bot;
|
||||
|
||||
fn deref(&self) -> &Bot {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#pinchatmessage).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct PinChatMessage<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
message_id: i32,
|
||||
disable_notification: Option<bool>,
|
||||
|
@ -46,7 +47,7 @@ impl<'a> PinChatMessage<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
message_id,
|
||||
disable_notification: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#promotechatmember).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct PromoteChatMember<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
can_change_info: Option<bool>,
|
||||
|
@ -53,7 +54,7 @@ impl<'a> PromoteChatMember<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
can_change_info: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#restrictchatmember).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct RestrictChatMember<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
permissions: ChatPermissions,
|
||||
|
@ -52,7 +53,7 @@ impl<'a> RestrictChatMember<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
permissions,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -12,9 +13,9 @@ use crate::{
|
|||
/// may be changed in the future.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendanimation).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendAnimation<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
pub chat_id: ChatId,
|
||||
pub animation: InputFile,
|
||||
pub duration: Option<u32>,
|
||||
|
@ -72,7 +73,7 @@ impl<'a> SendAnimation<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
animation,
|
||||
duration: None,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -16,9 +17,9 @@ use crate::{
|
|||
/// [The official docs](https://core.telegram.org/bots/api#sendaudio).
|
||||
///
|
||||
/// [`Bot::send_voice`]: crate::Bot::send_voice
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendAudio<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
audio: InputFile,
|
||||
caption: Option<String>,
|
||||
|
@ -76,7 +77,7 @@ impl<'a> SendAudio<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
audio,
|
||||
caption: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -25,10 +26,10 @@ use crate::{
|
|||
/// [ImageBot]: https://t.me/imagebot
|
||||
/// [`Bot::send_chat_action`]: crate::Bot::send_chat_action
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendChatAction<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
action: SendChatActionKind,
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ pub struct SendChatAction<'a> {
|
|||
/// A type of action used in [`SendChatAction`].
|
||||
///
|
||||
/// [`SendChatAction`]: crate::requests::SendChatAction
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Copy, Clone, Debug, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SendChatActionKind {
|
||||
/// For [text messages](crate::Bot::send_message).
|
||||
|
@ -95,7 +96,7 @@ impl<'a> SendChatAction<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
action,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendcontact).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendContact<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
phone_number: String,
|
||||
first_name: String,
|
||||
|
@ -56,7 +57,7 @@ impl<'a> SendContact<'a> {
|
|||
let phone_number = phone_number.into();
|
||||
let first_name = first_name.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
phone_number,
|
||||
first_name,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -11,9 +12,9 @@ use crate::{
|
|||
/// may be changed in the future.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#senddocument).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendDocument<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
document: InputFile,
|
||||
thumb: Option<InputFile>,
|
||||
|
@ -62,7 +63,7 @@ impl<'a> SendDocument<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
document,
|
||||
thumb: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendgame).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendGame<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: i32,
|
||||
game_short_name: String,
|
||||
disable_notification: Option<bool>,
|
||||
|
@ -44,7 +45,7 @@ impl<'a> SendGame<'a> {
|
|||
{
|
||||
let game_short_name = game_short_name.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
game_short_name,
|
||||
disable_notification: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendinvoice).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendInvoice<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: i32,
|
||||
title: String,
|
||||
description: String,
|
||||
|
@ -85,7 +86,7 @@ impl<'a> SendInvoice<'a> {
|
|||
let currency = currency.into();
|
||||
let prices = prices.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
title,
|
||||
description,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendlocation).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendLocation<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
latitude: f32,
|
||||
longitude: f32,
|
||||
|
@ -51,7 +52,7 @@ impl<'a> SendLocation<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
latitude,
|
||||
longitude,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -8,9 +9,9 @@ use crate::{
|
|||
/// Use this method to send a group of photos or videos as an album.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendmediagroup).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendMediaGroup<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
media: Vec<InputMedia>, // TODO: InputMediaPhoto and InputMediaVideo
|
||||
disable_notification: Option<bool>,
|
||||
|
@ -50,7 +51,7 @@ impl<'a> SendMediaGroup<'a> {
|
|||
let chat_id = chat_id.into();
|
||||
let media = media.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
media,
|
||||
disable_notification: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendmessage).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendMessage<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
pub chat_id: ChatId,
|
||||
pub text: String,
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
@ -46,7 +47,7 @@ impl<'a> SendMessage<'a> {
|
|||
T: Into<String>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
text: text.into(),
|
||||
parse_mode: None,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -8,9 +9,9 @@ use crate::{
|
|||
/// Use this method to send photos.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendphoto).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendPhoto<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
photo: InputFile,
|
||||
caption: Option<String>,
|
||||
|
@ -56,7 +57,7 @@ impl<'a> SendPhoto<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
photo,
|
||||
caption: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -12,10 +13,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendpoll).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendPoll<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
question: String,
|
||||
options: Vec<String>,
|
||||
|
@ -55,7 +56,7 @@ impl<'a> SendPoll<'a> {
|
|||
let question = question.into();
|
||||
let options = options.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
question,
|
||||
options,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -10,9 +11,9 @@ use crate::{
|
|||
/// [The official docs](https://core.telegram.org/bots/api#sendsticker).
|
||||
///
|
||||
/// [animated]: https://telegram.org/blog/animated-stickers
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendSticker<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
sticker: InputFile,
|
||||
disable_notification: Option<bool>,
|
||||
|
@ -52,7 +53,7 @@ impl<'a> SendSticker<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
sticker,
|
||||
disable_notification: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendvenue).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SendVenue<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
latitude: f32,
|
||||
longitude: f32,
|
||||
|
@ -60,7 +61,7 @@ impl<'a> SendVenue<'a> {
|
|||
let title = title.into();
|
||||
let address = address.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
latitude,
|
||||
longitude,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -12,9 +13,9 @@ use crate::{
|
|||
/// limit may be changed in the future.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sendvideo).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendVideo<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
video: InputFile,
|
||||
duration: Option<i32>,
|
||||
|
@ -75,7 +76,7 @@ impl<'a> SendVideo<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
video,
|
||||
duration: None,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -11,9 +12,9 @@ use crate::{
|
|||
/// [The official docs](https://core.telegram.org/bots/api#sendvideonote).
|
||||
///
|
||||
/// [v.4.0]: https://telegram.org/blog/video-messages-and-telescope
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendVideoNote<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
video_note: InputFile,
|
||||
duration: Option<i32>,
|
||||
|
@ -66,7 +67,7 @@ impl<'a> SendVideoNote<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
video_note,
|
||||
duration: None,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
|
@ -17,9 +18,9 @@ use crate::{
|
|||
///
|
||||
/// [`Audio`]: crate::types::Audio
|
||||
/// [`Document`]: crate::types::Document
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SendVoice<'a> {
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
voice: InputFile,
|
||||
caption: Option<String>,
|
||||
|
@ -68,7 +69,7 @@ impl<'a> SendVoice<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id: chat_id.into(),
|
||||
voice,
|
||||
caption: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -12,10 +13,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchatadministratorcustomtitle).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatAdministratorCustomTitle<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
custom_title: String,
|
||||
|
@ -50,7 +51,7 @@ impl<'a> SetChatAdministratorCustomTitle<'a> {
|
|||
let chat_id = chat_id.into();
|
||||
let custom_title = custom_title.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
custom_title,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchatdescription).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatDescription<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
description: Option<String>,
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ impl<'a> SetChatDescription<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
description: None,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchatpermissions).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatPermissions<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
permissions: ChatPermissions,
|
||||
}
|
||||
|
@ -48,7 +49,7 @@ impl<'a> SetChatPermissions<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
permissions,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchatphoto).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatPhoto<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
photo: InputFile,
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ impl<'a> SetChatPhoto<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
photo,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -15,10 +16,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchatstickerset).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatStickerSet<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
sticker_set_name: String,
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ impl<'a> SetChatStickerSet<'a> {
|
|||
let chat_id = chat_id.into();
|
||||
let sticker_set_name = sticker_set_name.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
sticker_set_name,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setchattitle).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetChatTitle<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
title: String,
|
||||
}
|
||||
|
@ -46,7 +47,7 @@ impl<'a> SetChatTitle<'a> {
|
|||
let chat_id = chat_id.into();
|
||||
let title = title.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
title,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -19,10 +20,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetGameScore<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
user_id: i32,
|
||||
|
@ -54,7 +55,7 @@ impl<'a> SetGameScore<'a> {
|
|||
score: i32,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
user_id,
|
||||
score,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -12,10 +13,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#setstickerpositioninset).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetStickerPositionInSet<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
sticker: String,
|
||||
position: i32,
|
||||
}
|
||||
|
@ -42,7 +43,7 @@ impl<'a> SetStickerPositionInSet<'a> {
|
|||
{
|
||||
let sticker = sticker.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
sticker,
|
||||
position,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -24,10 +25,10 @@ use crate::{
|
|||
///
|
||||
/// [`Update`]: crate::types::Update
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct SetWebhook<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
url: String,
|
||||
certificate: Option<InputFile>,
|
||||
max_connections: Option<i32>,
|
||||
|
@ -56,7 +57,7 @@ impl<'a> SetWebhook<'a> {
|
|||
{
|
||||
let url = url.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
url,
|
||||
certificate: None,
|
||||
max_connections: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -18,10 +19,10 @@ use crate::{
|
|||
/// [`Message`]: crate::types::Message
|
||||
/// [`True`]: crate::types::True
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct StopMessageLiveLocation<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
#[serde(flatten)]
|
||||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
@ -48,7 +49,7 @@ impl<'a> StopMessageLiveLocation<'a> {
|
|||
chat_or_inline_message: ChatOrInlineMessage,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_or_inline_message,
|
||||
reply_markup: None,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -11,10 +12,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#stoppoll).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct StopPoll<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
message_id: i32,
|
||||
reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
@ -44,7 +45,7 @@ impl<'a> StopPoll<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
message_id,
|
||||
reply_markup: None,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -14,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#unbanchatmember).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct UnbanChatMember<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
user_id: i32,
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ impl<'a> UnbanChatMember<'a> {
|
|||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
user_id,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
Bot,
|
||||
};
|
||||
|
||||
/// Use this method to unpin a message in a group, a supergroup, or a channel.
|
||||
///
|
||||
/// The bot must be an administrator in the chat for this to work and must have
|
||||
|
@ -15,10 +15,10 @@ use crate::{
|
|||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#unpinchatmessage).
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct UnpinChatMessage<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
chat_id: ChatId,
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,10 @@ impl<'a> UnpinChatMessage<'a> {
|
|||
C: Into<ChatId>,
|
||||
{
|
||||
let chat_id = chat_id.into();
|
||||
Self { bot, chat_id }
|
||||
Self {
|
||||
bot: BotWrapper(bot),
|
||||
chat_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the target chat or username of the target channel
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::BotWrapper;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
|
@ -16,10 +17,10 @@ use crate::{
|
|||
/// [`Bot::create_new_sticker_set`]: crate::Bot::create_new_sticker_set
|
||||
/// [`Bot::add_sticker_to_set`]: crate::Bot::add_sticker_to_set
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Eq, PartialEq, Debug, Clone, Serialize)]
|
||||
pub struct UploadStickerFile<'a> {
|
||||
#[serde(skip_serializing)]
|
||||
bot: &'a Bot,
|
||||
bot: BotWrapper<'a>,
|
||||
user_id: i32,
|
||||
png_sticker: InputFile,
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ impl<'a> UploadStickerFile<'a> {
|
|||
png_sticker: InputFile,
|
||||
) -> Self {
|
||||
Self {
|
||||
bot,
|
||||
bot: BotWrapper(bot),
|
||||
user_id,
|
||||
png_sticker,
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue