Fix missing MultipartRequest for create_new_sticker_set

This commit is contained in:
Сырцев Вадим Игоревич 2024-04-07 18:05:54 +03:00
parent cba7fbe743
commit 344ace253d
2 changed files with 16 additions and 2 deletions

View file

@ -1102,7 +1102,7 @@ impl Requester for Bot {
) )
} }
type CreateNewStickerSet = JsonRequest<payloads::CreateNewStickerSet>; type CreateNewStickerSet = MultipartRequest<payloads::CreateNewStickerSet>;
fn create_new_sticker_set<N, T, S>( fn create_new_sticker_set<N, T, S>(
&self, &self,

View file

@ -1,7 +1,7 @@
use crate::{ use crate::{
payloads, payloads,
requests::Payload, requests::Payload,
types::{InputFile, InputFileLike, InputMedia}, types::{InputFile, InputFileLike, InputMedia, InputSticker},
}; };
/// Payloads that need to be sent as `multipart/form-data` because they contain /// Payloads that need to be sent as `multipart/form-data` because they contain
@ -41,3 +41,17 @@ impl MultipartPayload for payloads::EditMessageMediaInline {
self.media.files_mut().for_each(|f| f.move_into(into)) self.media.files_mut().for_each(|f| f.move_into(into))
} }
} }
impl MultipartPayload for payloads::CreateNewStickerSet {
fn copy_files(&self, into: &mut dyn FnMut(InputFile)) {
self.stickers
.iter()
.for_each(|InputSticker { sticker: f, .. }: &InputSticker| f.copy_into(into))
}
fn move_files(&mut self, into: &mut dyn FnMut(InputFile)) {
self.stickers
.iter_mut()
.for_each(|InputSticker { sticker: f, .. }: &mut InputSticker| f.move_into(into))
}
}