deadzilla 12ed515cca feat: admin.py для управления ботом через docker exec
- Добавлен console_commands/admin.py — CLI-скрипт с командами
  pogoda, news, cat, morning, help
- Добавлен docstring к методу pg (отображается в !hp)
- Обновлён README.md: архитектура, администрирование в Docker, тесты
- Добавлены тесты test_admin.py (5 тестов)
- Итого тестов: 223
2026-06-12 16:06:35 +05:00

25 lines
879 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 discord.ext import commands
from utils.pogoda import API_URL_WEATHER, fetch_weather, format_weather_data_for_console
class Pg(commands.Cog):
"""Команда !pg — прогноз погоды для Магнитогорска"""
def __init__(self):
self.api_url = API_URL_WEATHER
@commands.command(name="pg")
async def pg(self, ctx):
"""Прогноз погоды в Магнитогорске"""
data = await fetch_weather(self.api_url)
if data is None:
await ctx.send("Не удалось получить данные о погоде.")
return
formatted = format_weather_data_for_console(data)
if not formatted:
await ctx.send("Не удалось получить данные о погоде.")
return
await ctx.send("\n".join(formatted))