Added .rl, fixed some messages, removed liveness probe.
This commit is contained in:
@ -146,12 +146,20 @@ impl Handler for CurrencyConverter {
|
|||||||
.or(cur_name) else{
|
.or(cur_name) else{
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
let Some(nominal) = valutes
|
||||||
|
.get(cur_name)
|
||||||
|
.and_then(|info| info.get("Nominal"))
|
||||||
|
.map(ToString::to_string)
|
||||||
|
.and_then(|value| value.as_str().parse::<f64>().ok())
|
||||||
|
else{
|
||||||
|
continue;
|
||||||
|
};
|
||||||
let calculated = valutes
|
let calculated = valutes
|
||||||
.get(cur_name)
|
.get(cur_name)
|
||||||
.and_then(|info| info.get("Value"))
|
.and_then(|info| info.get("Value"))
|
||||||
.map(ToString::to_string)
|
.map(ToString::to_string)
|
||||||
.and_then(|value| value.as_str().parse::<f64>().ok())
|
.and_then(|value| value.as_str().parse::<f64>().ok())
|
||||||
.map(|multiplier| multiplier * num_value);
|
.map(|multiplier| multiplier * num_value / nominal);
|
||||||
if let Some(value) = calculated {
|
if let Some(value) = calculated {
|
||||||
calucates.push(format!(
|
calucates.push(format!(
|
||||||
"<pre>{num_value} {cur_name} = {value:.2} RUB</pre><br>"
|
"<pre>{num_value} {cur_name} = {value:.2} RUB</pre><br>"
|
||||||
|
@ -25,7 +25,7 @@ async fn rotator(replied_message: Message, text: String) {
|
|||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
skip += 1;
|
skip += 1;
|
||||||
if skip == rotated.len() {
|
if skip == rotated.len() {
|
||||||
skip = 0;
|
skip = 1;
|
||||||
}
|
}
|
||||||
replied_message.edit(rotated).await.ok();
|
replied_message.edit(rotated).await.ok();
|
||||||
current = std::time::SystemTime::now();
|
current = std::time::SystemTime::now();
|
||||||
|
Reference in New Issue
Block a user