From 6dfe72a83a24f4a3636d58c0264e7dea20a61a8f Mon Sep 17 00:00:00 2001 From: randomuser Date: Tue, 20 Jul 2021 23:23:58 -0500 Subject: [PATCH] move duck testing logic to new method duck_test --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 4e8177d..3dbf10e 100644 --- a/main.py +++ b/main.py @@ -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):