summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormogad0n2021-01-11 01:08:06 +0530
committermogad0n2021-01-11 01:08:06 +0530
commit62a24b01ad3f63630f8c0b542172119cf08f2914 (patch)
tree74175b11bc7cd7ea5e9015afce4f9706b0f07938
parentb4480bb7709cd1bd8df9ff498a32f3a75f0a0b71 (diff)
downloadtripsit-62a24b01ad3f63630f8c0b542172119cf08f2914.tar.gz
tripsit-62a24b01ad3f63630f8c0b542172119cf08f2914.tar.bz2
tripsit-62a24b01ad3f63630f8c0b542172119cf08f2914.zip
num2words for lastdose
-rw-r--r--.gitignore1
-rw-r--r--plugin.py13
-rw-r--r--requirements.txt4
3 files changed, 10 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index c9b974b..37b5bbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
__pycache__
local
+venv/
diff --git a/plugin.py b/plugin.py
index 9ae5419..6d8d92e 100644
--- a/plugin.py
+++ b/plugin.py
@@ -30,6 +30,9 @@
from supybot import utils, plugins, ircutils, callbacks, world, conf, log
from supybot.commands import *
+
+
+from num2words import num2words
import dateutil.parser
import json
import requests
@@ -277,12 +280,8 @@ class Tripsit(callbacks.Plugin):
since_dose = time - dose_time
since_dose_seconds = since_dose.total_seconds()
if history:
- if history == 2:
- re = utils.str.format("Your %i'nd last dose was %s of %s via %s at %s %s, %T ago", history, dose, drug, method, str(dose_time), timezone, since_dose_seconds)
- elif history == 3:
- re = utils.str.format("Your %i'rd last dose was %s of %s via %s at %s %s, %T ago", history, dose, drug, method, str(dose_time), timezone, since_dose_seconds)
- else:
- re = utils.str.format("Your %i'th last dose was %s of %s via %s at %s %s, %T ago", history, dose, drug, method, str(dose_time), timezone, since_dose_seconds)
+ history = num2words(history, to='ordinal'):
+ re = utils.str.format("Your %i last dose was %s of %s via %s at %s %s, %T ago", history, dose, drug, method, str(dose_time), timezone, since_dose_seconds)
else:
re = utils.str.format("You last dosed %s of %s via %s at %s %s, %T ago", dose, drug, method, str(dose_time), timezone, since_dose_seconds)
irc.reply(re)
@@ -292,4 +291,4 @@ class Tripsit(callbacks.Plugin):
Class = Tripsit
-# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: \ No newline at end of file
+# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
diff --git a/requirements.txt b/requirements.txt
index 7c141b3..51f1ef9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,3 @@
-pytz==2020.1
+docopt==0.6.2
+num2words==0.5.10
+pytz==2020.5