let send_message use ChatId

This commit is contained in:
strongtu 2024-05-17 22:39:17 +08:00
parent c6c0378077
commit 703c65c0c2
5 changed files with 7 additions and 7 deletions

View file

@ -4031,7 +4031,7 @@ Schema(
params: [
Param(
name: "chat_id",
ty: i64,
ty: RawTy("ChatId"),
descr: Doc(md: "Unique identifier for the target chat"),
),
Param(

View file

@ -1264,7 +1264,7 @@ impl Requester for Bot {
type SendGame = JsonRequest<payloads::SendGame>;
fn send_game<G>(&self, chat_id: i64, game_short_name: G) -> Self::SendGame
fn send_game<G>(&self, chat_id: ChatId, game_short_name: G) -> Self::SendGame
where
G: Into<String>,
{

View file

@ -1301,9 +1301,9 @@ macro_rules! requester_forward {
(@method send_game $body:ident $ty:ident) => {
type SendGame = $ty![SendGame];
fn send_game<G>(&self, chat_id: i64, game_short_name: G) -> Self::SendGame where G: Into<String> {
fn send_game<G>(&self, chat_id: ChatId, game_short_name: G) -> Self::SendGame where G: Into<String> {
let this = self;
$body!(send_game this (chat_id: i64, game_short_name: G))
$body!(send_game this (chat_id: ChatId, game_short_name: G))
}
};
(@method set_game_score $body:ident $ty:ident) => {

View file

@ -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: i64,
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],
}

View file

@ -1093,7 +1093,7 @@ pub trait Requester {
type SendGame: Request<Payload = SendGame, Err = Self::Err>;
/// For Telegram documentation see [`SendGame`].
fn send_game<G>(&self, chat_id: i64, game_short_name: G) -> Self::SendGame
fn send_game<G>(&self, chat_id: ChatId, game_short_name: G) -> Self::SendGame
where
G: Into<String>;