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))