mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Fix ping-pong-bot
This commit is contained in:
parent
2c4102e2b3
commit
32d607daa9
4 changed files with 8 additions and 6 deletions
|
@ -7,7 +7,9 @@ async fn main() {
|
|||
log::info!("Starting the ping-pong bot!");
|
||||
|
||||
Dispatcher::new(Bot::new("MyAwesomeToken"))
|
||||
.message_handler(|ctx: HandlerCtx<Message>| ctx.reply("pong"))
|
||||
.message_handler(|ctx: HandlerCtx<Message>| async move {
|
||||
ctx.reply("pong").await
|
||||
})
|
||||
.dispatch()
|
||||
.await;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ mod tests {
|
|||
"url 2".to_string(),
|
||||
);
|
||||
|
||||
let markup = InlineKeyboardMarkup::new()
|
||||
let markup = InlineKeyboardMarkup::default()
|
||||
.append_row(vec![button1.clone(), button2.clone()]);
|
||||
|
||||
let expected = InlineKeyboardMarkup {
|
||||
|
@ -87,7 +87,7 @@ mod tests {
|
|||
"url 2".to_string(),
|
||||
);
|
||||
|
||||
let markup = InlineKeyboardMarkup::new()
|
||||
let markup = InlineKeyboardMarkup::default()
|
||||
.append_row(vec![button1.clone()])
|
||||
.append_to_row(button2.clone(), 0);
|
||||
|
||||
|
@ -109,7 +109,7 @@ mod tests {
|
|||
"url 2".to_string(),
|
||||
);
|
||||
|
||||
let markup = InlineKeyboardMarkup::new()
|
||||
let markup = InlineKeyboardMarkup::default()
|
||||
.append_row(vec![button1.clone()])
|
||||
.append_to_row(button2.clone(), 1);
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ mod tests {
|
|||
audio_file_id: String::from("audio_file_id"),
|
||||
caption: Some(String::from("caption")),
|
||||
parse_mode: Some(ParseMode::HTML),
|
||||
reply_markup: Some(InlineKeyboardMarkup::new()),
|
||||
reply_markup: Some(InlineKeyboardMarkup::default()),
|
||||
input_message_content: Some(InputMessageContent::Text {
|
||||
message_text: String::from("message_text"),
|
||||
parse_mode: Some(ParseMode::MarkdownV2),
|
||||
|
|
|
@ -20,7 +20,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn inline_keyboard_markup() {
|
||||
let data = InlineKeyboardMarkup::new();
|
||||
let data = InlineKeyboardMarkup::default();
|
||||
let expected = ReplyMarkup::InlineKeyboardMarkup(data.clone());
|
||||
let actual: ReplyMarkup = data.into();
|
||||
assert_eq!(actual, expected)
|
||||
|
|
Loading…
Add table
Reference in a new issue