fix some bugs
This commit is contained in:
parent
48096c3c6b
commit
7aac5d09a0
14
bot.py
14
bot.py
|
@ -55,7 +55,7 @@ class Server(BaseServer):
|
||||||
if line.params[-1][0] == '%':
|
if line.params[-1][0] == '%':
|
||||||
commands = line.params[-1][1:].split(' ')
|
commands = line.params[-1][1:].split(' ')
|
||||||
if commands[0] == "score":
|
if commands[0] == "score":
|
||||||
if len(commands) == 2:
|
if len(commands) == 1: commands.append(user)
|
||||||
if self.isDrunk(): b = Botany(commands[1])
|
if self.isDrunk(): b = Botany(commands[1])
|
||||||
else:
|
else:
|
||||||
b = Botany(userchooser(commands[1]))
|
b = Botany(userchooser(commands[1]))
|
||||||
|
@ -70,16 +70,14 @@ class Server(BaseServer):
|
||||||
else:
|
else:
|
||||||
await self.msg(channel, "vodka? what's vodka? *burp*", user)
|
await self.msg(channel, "vodka? what's vodka? *burp*", user)
|
||||||
elif commands[0] == "desc":
|
elif commands[0] == "desc":
|
||||||
if len(commands) == 2:
|
if len(commands) == 1: commands.append(user)
|
||||||
if self.isDrunk():
|
if self.isDrunk():
|
||||||
b = Botany(commands[1])
|
b = Botany(commands[1])
|
||||||
else:
|
else:
|
||||||
b = Botany(userchooser(commands[1]))
|
b = Botany(userchooser(commands[1]))
|
||||||
await self.msg(channel, b.plantDescription(), user)
|
await self.msg(channel, b.plantDescription(), user)
|
||||||
else:
|
|
||||||
await self.msg(channel, "specify user", user)
|
|
||||||
elif commands[0] == "water":
|
elif commands[0] == "water":
|
||||||
if len(commands) == 2:
|
if len(commands) == 1: commands.append(user)
|
||||||
if self.isDrunk():
|
if self.isDrunk():
|
||||||
b = Botany(commands[1])
|
b = Botany(commands[1])
|
||||||
if b.water("{} (via IRC)".format(user)):
|
if b.water("{} (via IRC)".format(user)):
|
||||||
|
@ -88,7 +86,7 @@ class Server(BaseServer):
|
||||||
await self.msg(channel, b.cantWater(), user)
|
await self.msg(channel, b.cantWater(), user)
|
||||||
else:
|
else:
|
||||||
b = Botany(userchooser(commands[1]))
|
b = Botany(userchooser(commands[1]))
|
||||||
while not b.water("{} (via IRC".format(user)):
|
while not b.water("{} (via IRC)".format(user)):
|
||||||
b = Botany(userchooser(commands[1]))
|
b = Botany(userchooser(commands[1]))
|
||||||
await self.msg(channel, b.watered(), user)
|
await self.msg(channel, b.watered(), user)
|
||||||
elif commands[0] == "help":
|
elif commands[0] == "help":
|
||||||
|
@ -98,6 +96,10 @@ class Server(BaseServer):
|
||||||
if user == self.admin:
|
if user == self.admin:
|
||||||
await self.send(build("JOIN", [commands[1]]))
|
await self.send(build("JOIN", [commands[1]]))
|
||||||
await self.msg(channel, "joined the channel {}".format(commands[1]), user)
|
await self.msg(channel, "joined the channel {}".format(commands[1]), user)
|
||||||
|
else:
|
||||||
|
await self.msg(channel, "you're not an admin", user)
|
||||||
|
else:
|
||||||
|
await self.msg(channel, "specify the channel", user)
|
||||||
elif commands[0] == "addowner":
|
elif commands[0] == "addowner":
|
||||||
if len(commands) == 2:
|
if len(commands) == 2:
|
||||||
if user == self.admin:
|
if user == self.admin:
|
||||||
|
|
|
@ -43,7 +43,8 @@ class Botany:
|
||||||
return []
|
return []
|
||||||
def score(self):
|
def score(self):
|
||||||
i = self.getInfo()
|
i = self.getInfo()
|
||||||
return i['score'] + min(i['last_watered'] - int(time.time()), 24 * 3600) * 0.2 * (i['generation'] - 1) + 1
|
if len(i) > 1: return i['score'] + min(i['last_watered'] - int(time.time()), 24 * 3600) * 0.2 * (i['generation'] - 1) + 1
|
||||||
|
return 0
|
||||||
|
|
||||||
class IRCBotany(Botany):
|
class IRCBotany(Botany):
|
||||||
def plantDescription(self):
|
def plantDescription(self):
|
||||||
|
|
Loading…
Reference in New Issue