Merge pull request #16 from ferristhecrab/dev

change reply_markup to its actual type
This commit is contained in:
Waffle Lapkin 2019-09-12 18:31:57 +03:00 committed by GitHub
commit 4c149ec6e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 14 deletions

View file

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

View file

@ -2,7 +2,7 @@ use crate::core::{
network, network,
requests::{ChatId, Request, RequestFuture, ResponseResult, RequestContext}, requests::{ChatId, Request, RequestFuture, ResponseResult, RequestContext},
requests::form_builder::FormBuilder, 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 /// 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>, pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message /// If the message is a reply, ID of the original message
pub reply_to_message_id: Option<i64>, 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> { impl<'a> Request<'a> for SendAudio<'a> {

View file

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

View file

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

View file

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