fix Type Errors again and again

This commit is contained in:
mogad0n 2020-09-17 22:48:05 +05:30
parent 2a78fb0b1f
commit fe08351275

View File

@ -181,17 +181,16 @@ class Tripsit(callbacks.Plugin):
if onset and "_unit" in drug["formatted_onset"]: if onset and "_unit" in drug["formatted_onset"]:
onset = "%s %s" % ( onset = "%s %s" % (
onset, drug["formatted_onset"]["_unit"]) onset, drug["formatted_onset"]["_unit"])
drug_and_method = name
if method: if method:
if not found_method: if not found_method:
method = method.title() method = method.title()
drug_and_method = "%s via %s" % (drug_and_method, method) drug_and_method = "%s via %s" % (drug_and_method, method)
else: else:
drug_and_method = name method = 'Undefined/Probably boofed'
method = 'Undefined'
hours = int(ago[0:2])
minutes = int(ago[2:4])
time = datetime.datetime.utcnow() time = datetime.datetime.utcnow()
if not ago: if not ago:
self.db[msg.nick] = {'type': 'idose' ,'time': str(time), 'dose': dose, 'drug': name, 'method': method } self.db[msg.nick] = {'type': 'idose' ,'time': str(time), 'dose': dose, 'drug': name, 'method': method }
@ -199,6 +198,8 @@ class Tripsit(callbacks.Plugin):
if not onset == None: if not onset == None:
re += f". You should start feeling effects {onset} from now" re += f". You should start feeling effects {onset} from now"
else: else:
hours = int(ago[0:2])
minutes = int(ago[2:4])
dose_td = datetime.timedelta(hours=hours, minutes=minutes) dose_td = datetime.timedelta(hours=hours, minutes=minutes)
time_dosed = time - dose_td time_dosed = time - dose_td
self.db[msg.nick] = {'type': 'hdose', 'time': str(time), 'time_dosed': str(time_dosed), 'dose': dose, 'drug': name, 'method': method } self.db[msg.nick] = {'type': 'hdose', 'time': str(time), 'time_dosed': str(time_dosed), 'dose': dose, 'drug': name, 'method': method }