Minor global var issue fix

This commit is contained in:
Argy 2021-06-18 01:43:10 +00:00
parent ae48ef5c9f
commit a69878043a
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import plugin, os.path, json, time
def water(user):
try:
try:
with open(os.path.expanduser("~{}/.botany/visitors.json".format(user))) as f:
visitors = json.load(f)
visitors.append(dict(timestamp=int(time.time()),user="cosmicbot"))
@ -9,7 +9,8 @@ def water(user):
json.dump(visitors,f,indent=2)
with open(os.path.expanduser("~{}/.botany/{}_plant_data.json".format(user,user))) as f:
plant_data = json.load(f)
global plant = plant_data['description']
global plant
plant = plant_data['description']
return True # success
except:
return False # failed