diff --git a/bot.py b/bot.py index 37f418a..589fdd4 100644 --- a/bot.py +++ b/bot.py @@ -13,8 +13,8 @@ from botany import IRCBotany as Botany from secrets import PASSWORD channels = [ -# "#bots", - "#club", + "#bots", +# "#club", "###", ] helpmessage = "hey, i'm botanybot. i water plants on ~club. my prefix is % and i was made by randomuser. check out https://ttm.sh/FoF.txt for more information." @@ -45,13 +45,22 @@ class Server(BaseServer): await self.msg(channel, helpmessage, user) if line.params[-1][0] == '%': commands = line.params[-1][1:].split(' ') - if commands[0] == "vodka": + if commands[0] == "score": + if len(commands) == 2: + if self.isDrunk(): b = Botany(commands[1]) + else: + b = Botany(userchooser(commands[1])) + while b.getInfo() == []: + b = Botany(userchooser(commands[1])) + i = b.getInfo() + await self.msg(channel, "{}'s score: {}".format(b.user, str(int(b.score()))), user) + elif commands[0] == "vodka": if self.isDrunk(): self.drunkentime = int(time.time()) await self.msg(channel, "glug glug glug", user) else: await self.msg(channel, "vodka? what's vodka? *burp*", user) - if commands[0] == "desc": + elif commands[0] == "desc": if len(commands) == 2: if self.isDrunk(): b = Botany(commands[1]) diff --git a/botany.py b/botany.py index 2f2f2ab..6accb16 100644 --- a/botany.py +++ b/botany.py @@ -40,6 +40,9 @@ class Botany: except: print("error in getInfo()") return [] + def score(self): + i = self.getInfo() + return i['score'] + min(i['last_watered'] - int(time.time()), 24 * 3600) * 0.2 * (i['generation'] - 1) + 1 class IRCBotany(Botany): def plantDescription(self):