diff --git a/app/bot.py b/app/bot.py index 99a8482b..7f15aa64 100755 --- a/app/bot.py +++ b/app/bot.py @@ -53,13 +53,6 @@ async def ask(ctx): questions.answer_question(ctx.message.content), ) -@bot.command(name='raws') -async def raws(ctx): - import weather - await ctx.send( - embed=weather.parse_message(ctx.message.content) - ) - @bot.command(name='invite') async def invite(ctx): # Default to creating the invite to the channel the message was sent in diff --git a/app/requirements.txt b/app/requirements.txt index af7afbdc..3816311c 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -5,5 +5,4 @@ lxml pandas requests wikipedia -wolframalpha -pyowm \ No newline at end of file +wolframalpha \ No newline at end of file diff --git a/app/weather.py b/app/weather.py deleted file mode 100644 index d3fa7bb0..00000000 --- a/app/weather.py +++ /dev/null @@ -1,36 +0,0 @@ -from pyowm.owm import OWM -import discord -import os -# import pprint -# pp = pprint.PrettyPrinter(indent=4) - - -def parse_message(message): - location = message.split()[1:] - print(location) - return get_weather(' '.join(location)) - - -def get_weather(location): - # owm = OWM('614e00c15660f75756544b83d556fe75') - owm = OWM(os.getenv('weather_api_key')) - mgr = owm.weather_manager() - observation = mgr.weather_at_place(location) # the observation object is a box containing a weather object - weather = observation.weather - - wind_data = weather.wind(unit='miles_hour') - wind_speed = wind_data['speed'] - wind_direction = degToCompass(wind_data['deg']) - - embed = discord.Embed(description="Weather for %s" % location, color=5793266, type="rich") - embed.add_field(name='Current weather', value=weather.detailed_status, inline=False) - embed.add_field(name='Wind', value="**Wind Speed**: %s, **Wind Direction**: %s" % (wind_speed, wind_direction), inline=False) - embed.add_field(name='Temperature (F)', value=weather.temperature('fahrenheit'), inline=False) - embed.add_field(name='Humidity', value=str(weather.humidity) + '%', inline=False) - - return embed - -def degToCompass(num): - val=int((num/22.5)+.5) - arr=["N","NNE","NE","ENE","E","ESE", "SE", "SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"] - return arr[(val % 16)] \ No newline at end of file