release-1.0.0
DustyP 8 years ago
parent 6e5ad99253
commit 62a58bc1ec

@ -486,27 +486,27 @@ class Utils:
f'Examples of valid time strings are in my help documentation.\n' \ f'Examples of valid time strings are in my help documentation.\n' \
f'Please try again.' f'Please try again.'
em.colour = discord.Colour.red() em.colour = discord.Colour.red()
try:
out_tz = pytz.timezone(timezone)
except pytz.exceptions.UnknownTimeZoneError:
for tz in pytz.all_timezones:
if timezone.lower() in tz.lower():
out_tz = pytz.timezone(tz)
break
else: else:
out_tz = None try:
em.title = 'Unknown Timezone.' out_tz = pytz.timezone(timezone)
em.colour = discord.Colour.red() except pytz.exceptions.UnknownTimeZoneError:
finally: for tz in pytz.all_timezones:
if out_tz: if timezone.lower() in tz.lower():
out_time = in_time.astimezone(out_tz) out_tz = pytz.timezone(tz)
em.add_field(name=f'{clock_emojis[(in_time.hour % 12)]} {in_time.strftime("%c")}', break
value='input', inline=False) else:
em.add_field(name=f'{clock_emojis[(out_time.hour % 12)]} {out_time.strftime("%c")}', out_tz = None
value='output', inline=False) em.title = 'Unknown Timezone.'
em.colour = self.bot.embed_color em.colour = discord.Colour.red()
await ctx.send(embed=em) finally:
if out_tz:
out_time = in_time.astimezone(out_tz)
em.add_field(name=f'{clock_emojis[(in_time.hour % 12)]} {in_time.strftime("%c")}',
value='input', inline=False)
em.add_field(name=f'{clock_emojis[(out_time.hour % 12)]} {out_time.strftime("%c")}',
value='output', inline=False)
em.colour = self.bot.embed_color
await ctx.send(embed=em)
@commands.command(name='purge', aliases=['clean', 'erase']) @commands.command(name='purge', aliases=['clean', 'erase'])
@commands.cooldown(1, 3, type=commands.BucketType.user) @commands.cooldown(1, 3, type=commands.BucketType.user)

Loading…
Cancel
Save