add percentage warning and sanity checking
This commit is contained in:
parent
6297b790df
commit
735d07fb77
3
bot.py
3
bot.py
@ -67,8 +67,9 @@ class Server(BaseServer):
|
|||||||
if len(commands) == 1: commands.append(user)
|
if len(commands) == 1: commands.append(user)
|
||||||
b = Botany(commands[1])
|
b = Botany(commands[1])
|
||||||
i = b.getInfo()
|
i = b.getInfo()
|
||||||
|
await self.msg(channel, "warning: the %pct command is experimental and could possibly not work. you have been warned.", user)
|
||||||
if len(i) > 1:
|
if len(i) > 1:
|
||||||
pct = (1 - ((time.time() - i['last_watered'])/86400)) * 100
|
pct = max((1 - ((time.time() - i['last_watered'])/86400)) * 100, 0)
|
||||||
await self.msg(channel, "plant percentage for {}: {}%".format(b.user, int(pct)), user)
|
await self.msg(channel, "plant percentage for {}: {}%".format(b.user, int(pct)), user)
|
||||||
else:
|
else:
|
||||||
await self.msg(channel, "couldn't find plant for {}".format(commands[1]), user)
|
await self.msg(channel, "couldn't find plant for {}".format(commands[1]), user)
|
||||||
|
Loading…
Reference in New Issue
Block a user