diff options
author | jan <jan@ruken.pw> | 2016-04-07 18:02:38 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-04-07 18:02:38 (UTC) |
commit | b367eca66519e5bc08519625bb2ddde2eef81f19 (patch) | |
tree | cb68a67a2b4e125cc4d483c82097c1f960b0141d /src | |
parent | 5fe11c7ffa1227f10139836a9c755a63dacc6916 (diff) |
mehr styling fuer topanime
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/topanime.rs | 19 |
1 files changed, 15 insertions, 4 deletions
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::*; | |||
3 | use std::fs::File; | 3 | use std::fs::File; |
4 | 4 | ||
5 | extern crate telegram_bot; | 5 | extern crate telegram_bot; |
6 | use telegram_bot::{Api, Message, MessageType}; | 6 | use telegram_bot::{Api, Message, MessageType, ParseMode}; |
7 | extern crate time; | 7 | extern crate time; |
8 | extern crate regex; | 8 | extern crate regex; |
9 | use self::regex::Regex; | 9 | use self::regex::Regex; |
@@ -63,14 +63,25 @@ impl Feature for TopAnime { | |||
63 | if self.animes.len() <= i { | 63 | if self.animes.len() <= i { |
64 | break; | 64 | break; |
65 | } | 65 | } |
66 | msg.push_str(&format!("{}. {} ({}%)\n", | 66 | let mut pref = ""; |
67 | if i % 2 != 0 { | ||
68 | pref = "*"; | ||
69 | } | ||
70 | msg.push_str(&format!("{}{}. {} ({}%){}\n", | ||
71 | pref, | ||
67 | i + 1, | 72 | i + 1, |
68 | self.animes[i].name, | 73 | self.animes[i].name, |
69 | self.animes[i].score)); | 74 | self.animes[i].score, |
75 | pref)); | ||
70 | } | 76 | } |
71 | println!("(benchm) anime before send: {}ms", | 77 | println!("(benchm) anime before send: {}ms", |
72 | (time::precise_time_ns() - start) / 1000000); | 78 | (time::precise_time_ns() - start) / 1000000); |
73 | if let Err(e) = a.send_message(m.chat.id(), msg, None, None, Some(m.message_id), None) { | 79 | if let Err(e) = a.send_message(m.chat.id(), |
80 | msg, | ||
81 | Some(ParseMode::Markdown), | ||
82 | None, | ||
83 | Some(m.message_id), | ||
84 | None) { | ||
74 | println!("{}", e); | 85 | println!("{}", e); |
75 | } | 86 | } |
76 | println!("(benchm) anime: {}ms", | 87 | println!("(benchm) anime: {}ms", |