change reply_markup to its actual type

This commit is contained in:
ferristhecrab 2019-09-12 20:20:40 +05:00
parent a6c8942063
commit e78f889778
5 changed files with 13 additions and 14 deletions

View file

@ -1,6 +1,6 @@
use serde::Serialize;
use crate::core::requests::{RequestContext, ChatId, Request, RequestFuture, ResponseResult};
use crate::core::types::Message;
use crate::core::types::{Message, ReplyMarkup};
use crate::core::network;
#[derive(Debug, Clone, Serialize)]
@ -32,7 +32,7 @@ pub struct EditMessageLiveLocation<'a> {
longitude: f64,
#[serde(skip_serializing_if="Option::is_none")]
/// A JSON-serialized object for a new inline keyboard.
reply_markup: Option<()> // TODO: add reply_markup
reply_markup: Option<ReplyMarkup>
}
impl<'a> Request<'a> for EditMessageLiveLocation<'a> {

View file

@ -2,7 +2,7 @@ use crate::core::{
network,
requests::{ChatId, Request, RequestFuture, ResponseResult, RequestContext},
requests::form_builder::FormBuilder,
types::{InputFile, ParseMode, Message},
types::{InputFile, ParseMode, Message, ReplyMarkup},
};
/// Use this method to send audio files, if you want Telegram clients to display
@ -54,7 +54,7 @@ pub struct SendAudio<'a> {
pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: Option<i64>,
pub reply_markup: Option<()> // TODO: add reply_markup
pub reply_markup: Option<ReplyMarkup>,
}
impl<'a> Request<'a> for SendAudio<'a> {

View file

@ -1,6 +1,6 @@
use crate::core::{
requests::{RequestContext, ChatId, Request, RequestFuture, ResponseResult},
types::Message,
types::{Message, ReplyMarkup},
network,
};
@ -33,7 +33,7 @@ pub struct SendLocation<'a> {
/// If the message is a reply, ID of the original message
reply_to_message_id: Option<i64>,
#[serde(skip_serializing_if="Option::is_none")]
reply_markup: Option<()>,
reply_markup: Option<ReplyMarkup>,
}
impl<'a> Request<'a> for SendLocation<'a> {

View file

@ -1,7 +1,6 @@
use crate::core::{
network,
types::Message,
types::ParseMode,
types::{Message, ParseMode, ReplyMarkup},
requests::{
form_builder::FormBuilder,
ChatId,
@ -45,7 +44,7 @@ pub struct SendMessage<'a> {
#[serde(skip_serializing_if="Option::is_none")]
pub reply_to_message_id: Option<i64>,
#[serde(skip_serializing_if="Option::is_none")]
pub reply_markup: Option<()>, // TODO: ReplyMarkup enum
pub reply_markup: Option<ReplyMarkup>,
}
impl<'a> Request<'a> for SendMessage<'a> {
@ -111,7 +110,7 @@ impl<'a> SendMessage<'a> {
self
}
pub fn reply_markup<T: Into<()>>(mut self, val: T) -> Self {
pub fn reply_markup<T: Into<ReplyMarkup>>(mut self, val: T) -> Self {
self.reply_markup = Some(val.into());
self
}

View file

@ -2,7 +2,7 @@ use std::path::Path;
use crate::core::{
network,
types::{ParseMode, Message, InputFile},
types::{ParseMode, Message, InputFile, ReplyMarkup},
requests::{
ChatId,
Request,
@ -44,8 +44,7 @@ pub struct SendPhoto<'a> {
pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: Option<i64>,
// TODO: add reply_markup
pub reply_markup: Option<ReplyMarkup>,
}
impl<'a> Request<'a> for SendPhoto<'a> {
@ -96,7 +95,8 @@ impl<'a> SendPhoto<'a> {
caption: None,
parse_mode: None,
disable_notification: None,
reply_to_message_id: None
reply_to_message_id: None,
reply_markup: None
}
}