bitbot-irc / bitbot-modules

Community repository of vaguely useful plugins that are too niche for mainline BitBot
GNU General Public License v2.0
8 stars 3 forks source link

Add ~redose command, and more aliases for "Smoked" ROA #10

Closed jarromie closed 6 months ago

jesopo commented 4 years ago

https://github.com/jesopo/bitbot-modules/blob/e1f6cd74e99ba54bf05a0e01daac907122ee172e/tripsit.py#L179-L182

should be replaced with

if len(lastdose) > 4:
    onset = lastdose[4]
else:
    onset = None

old settings in the db will have no index 4 in their idose, thus your code would cause an index error

jarromie commented 4 years ago

Fixed

jesopo commented 4 years ago

https://github.com/jesopo/bitbot-modules/blob/ed9099ccb07c8f35e6b46fe6726b294403dc41d0/tripsit.py#L176-L177

this needs an else:

else:
    method = None
    drug_and_method = drug_name

otherwise you get this:

  File "/opt/bitbot/modules/tripsit.py", line 187, in redose
    [drug_name, dose, method, utils.datetime.format.iso8601(now), onset])
UnboundLocalError: local variable 'method' referenced before assignment