add pct command
This commit is contained in:
parent
7ab890cf51
commit
ce7ea7ea60
11
bot.py
11
bot.py
|
@ -15,7 +15,7 @@ from secrets import PASSWORD
|
||||||
|
|
||||||
channels = [
|
channels = [
|
||||||
"#bots",
|
"#bots",
|
||||||
"#club",
|
# "#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/Fs4.txt for more information."
|
helpmessage = "hey, i'm botanybot. i water plants on ~club. my prefix is % and i was made by randomuser. check out https://ttm.sh/Fs4.txt for more information."
|
||||||
|
@ -63,6 +63,15 @@ class Server(BaseServer):
|
||||||
b = Botany(userchooser(commands[1]))
|
b = Botany(userchooser(commands[1]))
|
||||||
i = b.getInfo()
|
i = b.getInfo()
|
||||||
await self.msg(channel, "{}'s score: {}".format(b.user, str(int(b.score()))), user)
|
await self.msg(channel, "{}'s score: {}".format(b.user, str(int(b.score()))), user)
|
||||||
|
elif commands[0] == "pct":
|
||||||
|
if len(commands) == 1: commands.append(user)
|
||||||
|
b = Botany(commands[1])
|
||||||
|
i = b.getInfo()
|
||||||
|
if len(i) > 1:
|
||||||
|
pct = (1 - ((time.time() - i['last_watered'])/86400)) * 100
|
||||||
|
await self.msg(channel, "plant percentage for {}: {}%".format(b.user, int(pct)), user)
|
||||||
|
else:
|
||||||
|
await self.msg(channel, "couldn't find plant for {}".format(commands[1]), user)
|
||||||
elif commands[0] == "vodka":
|
elif commands[0] == "vodka":
|
||||||
if self.isDrunk():
|
if self.isDrunk():
|
||||||
self.drunkentime = int(time.time())
|
self.drunkentime = int(time.time())
|
||||||
|
|
Loading…
Reference in New Issue