From b367eca66519e5bc08519625bb2ddde2eef81f19 Mon Sep 17 00:00:00 2001 From: jan Date: Thu, 7 Apr 2016 20:02:38 +0200 Subject: mehr styling fuer topanime diff --git a/src/feature/topanime.rs b/src/feature/topanime.rs index 7380b11..44c7ea0 100644 --- a/src/feature/topanime.rs +++ b/src/feature/topanime.rs @@ -3,7 +3,7 @@ use std::io::prelude::*; use std::fs::File; extern crate telegram_bot; -use telegram_bot::{Api, Message, MessageType}; +use telegram_bot::{Api, Message, MessageType, ParseMode}; extern crate time; extern crate regex; use self::regex::Regex; @@ -63,14 +63,25 @@ impl Feature for TopAnime { if self.animes.len() <= i { break; } - msg.push_str(&format!("{}. {} ({}%)\n", + let mut pref = ""; + if i % 2 != 0 { + pref = "*"; + } + msg.push_str(&format!("{}{}. {} ({}%){}\n", + pref, i + 1, self.animes[i].name, - self.animes[i].score)); + self.animes[i].score, + pref)); } println!("(benchm) anime before send: {}ms", (time::precise_time_ns() - start) / 1000000); - if let Err(e) = a.send_message(m.chat.id(), msg, None, None, Some(m.message_id), None) { + if let Err(e) = a.send_message(m.chat.id(), + msg, + Some(ParseMode::Markdown), + None, + Some(m.message_id), + None) { println!("{}", e); } println!("(benchm) anime: {}ms", -- cgit v0.10.1