From 32804aa9b2d600cb5d780e34a5d16b828c769f38 Mon Sep 17 00:00:00 2001 From: Noi Date: Wed, 6 Oct 2021 20:17:20 -0700 Subject: [PATCH] Automatically rename 'Calcutta' to 'Kolkata' --- commands.py | 12 ++++++++---- common.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/commands.py b/commands.py index 634a0a1..c421e56 100644 --- a/commands.py +++ b/commands.py @@ -125,12 +125,14 @@ class WtCommands: await channel.send(':x: Zone parameter is required.') return try: - zoneinput = tzlcmap[wspl[1].lower()] + userinput = wspl[1].lower() + if userinput == "asia/calcutta": userinput = "asia/kolkata" + zoneinput = tzlcmap[userinput] except KeyError: await channel.send(self.errStrInvalidZone) return self.userdb.update_user(guild.id, author.id, zoneinput) - await channel.send(':white_check_mark: Your zone has been set.') + await channel.send(f':white_check_mark: Your time zone has been set to **{zoneinput}**.') async def cmd_setFor(self, guild: discord.Guild, channel: discord.TextChannel, author: discord.User, msgcontent: str): if not self._isUserAdmin(author): @@ -155,14 +157,16 @@ class WtCommands: # Check the third parameter try: - zoneinput = tzlcmap[wspl[2].lower()] + userinput = wspl[2].lower() + if userinput == "asia/calcutta": userinput = "asia/kolkata" + zoneinput = tzlcmap[userinput] except KeyError: await channel.send(self.errStrInvalidZone) return # Do the thing self.userdb.update_user(guild.id, targetuser.id, zoneinput) - await channel.send(':white_check_mark: Set zone for **' + targetuser.name + '#' + targetuser.discriminator + '**.') + await channel.send(f':white_check_mark: Time zone for **{targetuser.name}#{targetuser.discriminator}** set to **{zoneinput}**.') async def cmd_list(self, guild: discord.Guild, channel: discord.TextChannel, author: discord.User, msgcontent: str): wspl = msgcontent.split(' ', 1) diff --git a/common.py b/common.py index 33ca800..52d31ad 100644 --- a/common.py +++ b/common.py @@ -4,7 +4,7 @@ import pytz from datetime import datetime # Bot's current version (as a string), for use in the help command -BotVersion = "1.3.3" +BotVersion = "1.3.4" # For case-insensitive time zone lookup, map lowercase tzdata entries with # entires with proper case. pytz is case sensitive.