-
Notifications
You must be signed in to change notification settings - Fork 1
/
weatherassets.py
32 lines (24 loc) · 1.38 KB
/
weatherassets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import nextcord
key_features = {
'temp' : 'Temp(in ℃):',
'feels_like' : 'Feels Like(in ℃):',
'temp_max' : 'Max Temp(in ℃):',
'temp_min' : 'Min Temp(in ℃):',
'humidity' : 'Humidity(in %):',
'pressure' : 'Pressure(in mb):'
}
def parse_data(data):
return data
def weathermsg(data, location):
location = location.title()
weathermessage = nextcord.Embed(title=f'{location} Weather', description=f'Here is the weather data for {location}.', colour=nextcord.Colour.blurple())
for key in data:
weathermessage.add_field(name=key_features[key], value=data[key], inline=True)
weathermessage.set_footer(icon_url="https://pbs.twimg.com/profile_images/1173919481082580992/f95OeyEW_400x400.jpg", text = "Powered by openweathermap.org")
weathermessage.set_thumbnail(url="https://icons.iconarchive.com/icons/papirus-team/papirus-apps/128/weather-icon.png")
return weathermessage
def error_message():
weathererror = nextcord.Embed(title='Location Error', description='There was an error retrieving weather data for that location.', colour=nextcord.Colour.red())
weathererror.set_thumbnail(url="https://cdn0.iconfinder.com/data/icons/kenline/100/12-512.png")
weathererror.set_footer(icon_url="https://pbs.twimg.com/profile_images/1173919481082580992/f95OeyEW_400x400.jpg", text = "Powered by openweathermap.org")
return weathererror