fix collect

This commit is contained in:
root 2020-01-02 00:30:12 +00:00
parent 52326276c9
commit cfde04e2fa
1 changed files with 4 additions and 4 deletions

View File

@ -97,11 +97,11 @@ def collect(bot, trigger):
# make sure second arg is a number # make sure second arg is a number
try: try:
float(trigger.group(4)) float(trigger.group(4))
else: except:
bot.say('Second arg must be a number! ' + syntax_err_msg) bot.say('Second arg must be a number! ' + syntax_err_msg)
return return
item = trigger.group(3).lowercase() item = str(trigger.group(3)).lower()
quantity = float(trigger.group(4)) quantity = float(trigger.group(4))
# the values must be ints or floats # the values must be ints or floats
@ -111,7 +111,7 @@ def collect(bot, trigger):
} }
# check if we know the value for the item # check if we know the value for the item
if Prices.contains(item): if item in Prices:
pass pass
else: else:
bot.say(item + "!?! I don't know the value!") bot.say(item + "!?! I don't know the value!")
@ -144,7 +144,7 @@ def collect(bot, trigger):
try: try:
value_of_one_item = float(Prices.get(item)) value_of_one_item = float(Prices.get(item))
else: except:
# the values in Prices must be ints or floats, of course # the values in Prices must be ints or floats, of course
bot.say("Couldn't convert item value to a float! How?!? Why?!?") bot.say("Couldn't convert item value to a float! How?!? Why?!?")
return return