NameError

This commit is contained in:
mogad0n 2020-09-18 10:58:06 +05:30
parent 4f9ff0feb1
commit 28f4b68b94

View File

@ -38,9 +38,6 @@ import sys
import datetime import datetime
import pytz import pytz
ct = datetime.datetime.now(tz=tz)
import datetime
import time
try: try:
from supybot.i18n import PluginInternationalization from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Tripsit') _ = PluginInternationalization('Tripsit')
@ -209,8 +206,8 @@ class Tripsit(callbacks.Plugin):
ih = msg.prefix.split("!")[1] ih = msg.prefix.split("!")[1]
if self.db[ih] is not None: if self.db[ih] is not None:
timezone = self.db[ih] timezone = self.db[ih]
tz = pytz.timezone(timezone) timez = pytz.timezone(timezone)
time = datetime.datetime.now(tz=tz) time = datetime.datetime.now(tz=timez)
else: else:
timezone = 'UTC' timezone = 'UTC'
time = datetime.datetime.utcnow() time = datetime.datetime.utcnow()
@ -263,8 +260,8 @@ class Tripsit(callbacks.Plugin):
if timezone == 'UTC': if timezone == 'UTC':
time = datetime.datetime.utcnow() time = datetime.datetime.utcnow()
else: else:
tz = pytz.timezone(timezone) timez = pytz.timezone(timezone)
time = datetime.datetime.now(tz=tz) time = datetime.datetime.now(tz=timez)
dose_time = dateutil.parser.isoparse(lastdose['time']) dose_time = dateutil.parser.isoparse(lastdose['time'])
since_dose = time - dose_time since_dose = time - dose_time
since_dose_seconds = since_dose.total_seconds() since_dose_seconds = since_dose.total_seconds()