~sircmpwn/public-inbox

reminderbot: Convert timezone into a str before save v1 APPLIED

Pedro Lucas Porcellis: 1
 Convert timezone into a str before save 

 1 files changed, 3 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/public-inbox/patches/21651/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH reminderbot] Convert timezone into a str before save Export this patch

It was trying to shove it a DstTzInfo entirely into redis which was
complaining that it should convert to a byte, string or number first.
---
 reminderbot/bot.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/reminderbot/bot.py b/reminderbot/bot.py
index 01cc30b..0e81a0c 100755
--- a/reminderbot/bot.py
+++ b/reminderbot/bot.py
@@ -87,9 +87,10 @@ async def tz(tz, message=None):
    ".tz [timezone]: Sets the user's timezone"
    try:
        tz = timezone(tz)
        redis.set("tz." + message.sender.name, tz)
        redis.set("tz." + message.sender.name, str(tz))
        return "Got it"
    except:
    except Exception as e:
        logger.debug(f"Something was wrong when parsing the tz: {e}")
        return "I don't know that timezone. See https://github.com/newvem/pytz"

@cmds.command("remindme")
-- 
2.31.0
Thanks!

To git@git.sr.ht:~sircmpwn/reminderbot
   adace72..  master -> master