move duck testing logic to new method duck_test

This commit is contained in:
randomuser 2021-07-20 23:23:58 -05:00
parent b41d315056
commit 6dfe72a83a
1 changed files with 3 additions and 1 deletions

View File

@ -30,6 +30,8 @@ class Server(BaseServer):
self.duckactive = True
self.duckactivetime = time.time()
await self.msgall(lang["duck"])
async def duck_test(self):
if self.messages > 1 and random.randint(0, 99) < 10: await self.new_duck()
async def misstime(self):
return format(time.time() - self.lastduck, '.2f')
async def coughttime(self):
@ -60,7 +62,7 @@ class Server(BaseServer):
return
self.messages += 1
if self.messages > 1 and random.randint(0, 100) < 10: await self.new_duck()
self.duck_test()
elif line.command == "INVITE":
await self.send(build("JOIN", [line.params[1]]))
async def line_send(self, line: Line):