Error handling for corona function if people type in nonsensical locations
This commit is contained in:
parent
e3ced41f23
commit
ce735ed991
@ -48,9 +48,12 @@ def query_csv(csv_path, location):
|
||||
|
||||
def sum_numbers(location):
|
||||
today, yesterday = get_csv()
|
||||
|
||||
try:
|
||||
last_updated, yesterday_sum = query_csv(yesterday, location)
|
||||
last_updated, today_sum = query_csv(today, location)
|
||||
except TypeError:
|
||||
return discord.Embed(description="No data for %s. Did you make a typo?" % location, color=0x428bca, type="rich")
|
||||
|
||||
|
||||
confirmed = "%s (+%s from yesterday)" % (today_sum['Confirmed'], int(today_sum['Confirmed']) - int(yesterday_sum['Confirmed']))
|
||||
deaths = "%s (+%s from yesterday)" % (today_sum['Deaths'], int(today_sum['Deaths']) - int(yesterday_sum['Deaths']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user