Upload files to "/"

This commit is contained in:
2026-05-23 15:11:39 +00:00
commit a808355f00
5 changed files with 196 additions and 0 deletions

39
CurrencyAnalyzer.java Normal file
View File

@@ -0,0 +1,39 @@
public class CurrencyAnalyzer {
private static double lastValue = -1;
public static void analyze(double current) {
if (lastValue == -1) {
lastValue = current;
// Уведомление при запуске
String startMsg = "✅ <b>Мониторинг курса USD запущен</b>\n" +
"Текущий курс: <b>" + current + "</b> ₽";
TelegramNotifier.sendMessage(startMsg);
System.out.println("Начальное значение USD: " + current);
return;
}
String changeMsg = "";
if (current > lastValue) {
changeMsg = "📈 Курс доллара <b>вырос ↑</b>";
} else if (current < lastValue) {
changeMsg = "📉 Курс доллара <b>упал ↓</b>";
} else {
return; // без изменений — не спамим
}
// Уведомление в Telegram
String telegramMsg = changeMsg + "\n" +
"Было: <b>" + lastValue + "</b> ₽\n" +
"Стало: <b>" + current + "</b> ₽";
TelegramNotifier.sendMessage(telegramMsg);
// Вывод в консоль (чистый текст)
System.out.println(changeMsg.replace("<b>", "").replace("</b>", "") +
" (было " + lastValue + ", стало " + current + ")");
lastValue = current;
}
}