deadzilla 560dc558a9 refactor: убрал дублирование логики получения данных
- utils/pogoda.py: добавлена API_URL_WEATHER, format_weather_for_embed(),
  проверка None в format_weather_data_for_console()
- utils/morning_runner.py: вынесен MorningData (dataclass) и gather_morning();
  run_morning() использует их вместо ручного asyncio.gather
- utils/__init__.py: экспортирован публичный API (__all__)
- commands/pg.py: убран ручной парсинг погоды, используется
  format_weather_data_for_console()
- console_commands/morning.py: дубликат asyncio.gather заменён на gather_morning()
- console_commands/pogoda.py: хардкод URL заменён на API_URL_WEATHER
- console_commands/cat.py: заглушка заменена на рабочий вызов fetch_cat()
- tests/test_commands_pg.py: обновлён тест fetch_returns_none (бот теперь
  отправляет сообщение об ошибке вместо молчаливого возврата)
2026-06-09 17:37:18 +05:00

11 lines
292 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from utils.cat import fetch_cat
async def cat(stop_event, bot):
"""Вывести URL случайного котика"""
url = await fetch_cat()
if url is None:
print("Не удалось получить котика.")
return
print(f"Котик: {url}")