diff --git a/commands/water.py b/commands/water.py index 9346759..1093c8b 100644 --- a/commands/water.py +++ b/commands/water.py @@ -1,10 +1,10 @@ import plugin, os.path, json, time -def water(user): +def water(user,by="cosmicbot"): 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")) + visitors.append(dict(timestamp=int(time.time()),user=by)) with open(os.path.expanduser("~{}/.botany/visitors.json".format(user)),"w") as f: json.dump(visitors,f,indent=2) with open(os.path.expanduser("~{}/.botany/{}_plant_data.json".format(user,user))) as f: @@ -15,7 +15,7 @@ def water(user): @plugin.command("water") def cmd_water(bot,channel,nick,user=None): if user is not None: - if plant := water(user): + if plant := water(user,nick): bot.say(channel,f"Watered _{user}_'s {plant}!") else: bot.say(channel,f"Unable to water _{user}_'s plant; are you sure they have one?")