num2words for lastdose
This commit is contained in:
parent
b4480bb770
commit
62a24b01ad
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
local
|
local
|
||||||
|
venv/
|
||||||
|
11
plugin.py
11
plugin.py
@ -30,6 +30,9 @@
|
|||||||
|
|
||||||
from supybot import utils, plugins, ircutils, callbacks, world, conf, log
|
from supybot import utils, plugins, ircutils, callbacks, world, conf, log
|
||||||
from supybot.commands import *
|
from supybot.commands import *
|
||||||
|
|
||||||
|
|
||||||
|
from num2words import num2words
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
@ -277,12 +280,8 @@ class Tripsit(callbacks.Plugin):
|
|||||||
since_dose = time - dose_time
|
since_dose = time - dose_time
|
||||||
since_dose_seconds = since_dose.total_seconds()
|
since_dose_seconds = since_dose.total_seconds()
|
||||||
if history:
|
if history:
|
||||||
if history == 2:
|
history = num2words(history, to='ordinal'):
|
||||||
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)
|
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)
|
||||||
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)
|
|
||||||
else:
|
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)
|
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)
|
irc.reply(re)
|
||||||
|
@ -1 +1,3 @@
|
|||||||
pytz==2020.1
|
docopt==0.6.2
|
||||||
|
num2words==0.5.10
|
||||||
|
pytz==2020.5
|
||||||
|
Loading…
Reference in New Issue
Block a user