示例#1
0
    async def meteo(self, ctx, city: str):
        """
        Simple Weather report
        """

        result = url_meteo(city)
        fetch = data_fetch(result)
        data = data_return(fetch)

        condition = f"{data['main']}, {data['description']}"

        embed = discord.Embed(title="Meteo", color=discord.Colour.dark_red())

        embed.set_footer(text="Powered by https://openweathermap.org")

        embed.add_field(name='🌍 **Location**',
                        value=f"{data['city']}, {data['country']}")
        embed.add_field(name="\N{CLOUD} **Condition**", value=condition)
        embed.add_field(name='\N{FACE WITH COLD SWEAT} **Humidity**',
                        value="{}%".format(data['humidity']))
        embed.add_field(name="\N{THERMOMETER} **Temperature**",
                        value=data['temp'])
        embed.add_field(name='\N{DASH SYMBOL} **Wind Speed**',
                        value="{}m/s".format(data['wind']))
        await ctx.send(embed=embed)
示例#2
0
    async def gmeteo(self, ctx, city: str):
        """
        Full Weather report
        """

        result = url_meteo(city)
        fetch = data_fetch(result)
        data = data_return(fetch)

        condition = f"{data['main']}, {data['description']}"

        embed = discord.Embed(title="Meteo", color=discord.Colour.dark_red())
        embed.set_footer(text="Powered by https://openweathermap.org")

        embed.add_field(name='🌍 **Location**',
                        value=f"{data['city']}, {data['country']}")
        embed.add_field(name="\N{CLOUD} **Condition**", value=condition)

        embed.add_field(name="\N{THERMOMETER} **Temperature**",
                        value=data['temp'])
        embed.add_field(name='Temperature min',
                        value='{}°C'.format(data['temp_min']))
        embed.add_field(name='Temperature max',
                        value='{}°C'.format(data['temp_max']))
        embed.add_field(name='\N{FACE WITH COLD SWEAT} **Humidity**',
                        value="{}%".format(data['humidity']))
        embed.add_field(name='Pressure',
                        value="{}hPa".format(data['pressure']))
        embed.add_field(name='\N{SUNRISE OVER MOUNTAINS} **Sunrise (UTC)**',
                        value=data['sunrise'])
        embed.add_field(name='\N{SUNSET OVER BUILDINGS} **Sunset (UTC)**',
                        value=data['sunset'])
        embed.add_field(name='\N{DASH SYMBOL} **Wind Speed**',
                        value="{}m/s".format(data['wind']))
        embed.add_field(name='Cloudiness',
                        value="{}%".format(data['cloudiness']))

        await ctx.send(embed=embed)