mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Merge pull request #1066 from strongtu/master
send_game needs chat_id by ChatId not u32
This commit is contained in:
commit
89ad80dcca
7 changed files with 15 additions and 9 deletions
|
@ -106,6 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fix roundtrip de/serialization of `InlineQueryResult` ([#990][pr990])
|
||||
- Deserialization of `ApiError::CantParseEntities` ([#839][pr839])
|
||||
- Deserialization of empty (content-less) messages that can sometimes appear as a part of callback query ([#850][pr850], issue [#873][issue873])
|
||||
- Type of `chat_id` in `send_game`: `u32` => `ChatId` ([#1066][pr1066])
|
||||
|
||||
[pr839]: https://github.com/teloxide/teloxide/pull/839
|
||||
[pr879]: https://github.com/teloxide/teloxide/pull/879
|
||||
|
@ -113,6 +114,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
[pr854]: https://github.com/teloxide/teloxide/pull/854
|
||||
[pr936]: https://github.com/teloxide/teloxide/pull/936
|
||||
[pr990]: https://github.com/teloxide/teloxide/pull/990
|
||||
[pr990]: https://github.com/teloxide/teloxide/pull/990
|
||||
[pr1066]: https://github.com/teloxide/teloxide/pull/1066
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -4271,7 +4271,7 @@ Schema(
|
|||
params: [
|
||||
Param(
|
||||
name: "chat_id",
|
||||
ty: u32,
|
||||
ty: RawTy("ChatId"),
|
||||
descr: Doc(md: "Unique identifier for the target chat"),
|
||||
),
|
||||
Param(
|
||||
|
|
|
@ -941,7 +941,7 @@ trait ErasableRequester<'a> {
|
|||
|
||||
fn send_game(
|
||||
&self,
|
||||
chat_id: u32,
|
||||
chat_id: ChatId,
|
||||
game_short_name: String,
|
||||
) -> ErasedRequest<'a, SendGame, Self::Err>;
|
||||
|
||||
|
@ -1859,7 +1859,7 @@ where
|
|||
|
||||
fn send_game(
|
||||
&self,
|
||||
chat_id: u32,
|
||||
chat_id: ChatId,
|
||||
game_short_name: String,
|
||||
) -> ErasedRequest<'a, SendGame, Self::Err> {
|
||||
Requester::send_game(self, chat_id, game_short_name).erase()
|
||||
|
|
|
@ -1383,8 +1383,9 @@ impl Requester for Bot {
|
|||
|
||||
type SendGame = JsonRequest<payloads::SendGame>;
|
||||
|
||||
fn send_game<G>(&self, chat_id: u32, game_short_name: G) -> Self::SendGame
|
||||
fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
G: Into<String>,
|
||||
{
|
||||
Self::SendGame::new(self.clone(), payloads::SendGame::new(chat_id, game_short_name))
|
||||
|
|
|
@ -1406,9 +1406,10 @@ macro_rules! requester_forward {
|
|||
(@method send_game $body:ident $ty:ident) => {
|
||||
type SendGame = $ty![SendGame];
|
||||
|
||||
fn send_game<G>(&self, chat_id: u32, game_short_name: G) -> Self::SendGame where G: Into<String> {
|
||||
fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame where C: Into<ChatId>,
|
||||
G: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_game this (chat_id: u32, game_short_name: G))
|
||||
$body!(send_game this (chat_id: C, game_short_name: G))
|
||||
}
|
||||
};
|
||||
(@method set_game_score $body:ident $ty:ident) => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{Message, MessageId, ReplyMarkup, ThreadId};
|
||||
use crate::types::{ChatId, Message, MessageId, ReplyMarkup, ThreadId};
|
||||
|
||||
impl_payload! {
|
||||
/// Use this method to send a game. On success, the sent [`Message`] is returned.
|
||||
|
@ -12,7 +12,7 @@ impl_payload! {
|
|||
pub SendGame (SendGameSetters) => Message {
|
||||
required {
|
||||
/// Unique identifier for the target chat
|
||||
pub chat_id: u32,
|
||||
pub chat_id: ChatId [into],
|
||||
/// Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
|
||||
pub game_short_name: String [into],
|
||||
}
|
||||
|
|
|
@ -1189,8 +1189,9 @@ pub trait Requester {
|
|||
type SendGame: Request<Payload = SendGame, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`SendGame`].
|
||||
fn send_game<G>(&self, chat_id: u32, game_short_name: G) -> Self::SendGame
|
||||
fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
G: Into<String>;
|
||||
|
||||
type SetGameScore: Request<Payload = SetGameScore, Err = Self::Err>;
|
||||
|
|
Loading…
Reference in a new issue