From 9d1bc6e053699d423932da44f32c7c0186c8d657 Mon Sep 17 00:00:00 2001 From: lickthecheese Date: Sat, 18 Apr 2020 17:26:32 -0400 Subject: [PATCH] better timing --- bot.py | 8 +++++--- modules/__pycache__/bake.cpython-36.pyc | Bin 4920 -> 4933 bytes modules/__pycache__/markov.cpython-36.pyc | Bin 1165 -> 1170 bytes modules/markov.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index e96e34c..48c89f2 100755 --- a/bot.py +++ b/bot.py @@ -43,13 +43,15 @@ class Oven(pydle.Client): await self.raw[i](self, chan,source,msg) if msg[:len(self.prefix)] == self.prefix: if time.time() < self.timeout: - self.timeout += 2 - print('messages are being sent too fast!') + self.timeout += 1 + print('messages are being sent too fast! ({}s)'.format(self.timeout-time.time())) + if await self.is_admin(source) and msg == '{}recv'.format(self.prefix): + self.timeout = 0 return if time.time()-1.5 < self.timeout: await self.message(chan, 'woah woah, slow it down there, or il get mad and wont bake your food') - self.timeout = time.time()+1 + self.timeout = time.time()+0.5 msg = msg[len(self.prefix):] cmd = msg.split(' ')[0] msg = msg[len(cmd)+1:] diff --git a/modules/__pycache__/bake.cpython-36.pyc b/modules/__pycache__/bake.cpython-36.pyc index 54e356a084b3abb1ee668607ed7e5db66fa504f5..78c384eb3d98c45543915df88972f7d481feb3c8 100644 GIT binary patch delta 422 zcmXYrKT88a5XE;dcYA-5(_HX0f#gi030%}7C@5GOf+@7n#zrAz6}^DUCW6QYgi}Gm zYCA!+PAAt`*+~2lR$AJ`ui$L3nBVTaee-5t%Y(AHXxrA>#>3v%i+QJ61R?Ye)v1U_ zt>zwZ6kv|27N|T%5hd4328p3oXkNh!;js+rkzLVS~|YC#`4dL84u*fFx$kIoEFu?ryk3ah}u=ESq*I`eSd zg6hZwf>Y5Qca5?)E;C)8sIE0rRPbL`@+Pw6TklAXsQ&7m%!=7f`&Uu-G7Ym4elQ zgKZi;lQHUD$6+k(9 zn;1fB8KqT3Mq)G`k&PY_S%6CTl01NNSaqt2JUVcozmAv>J*S@oW#jy%*)HQJz*o81QR32WO*h@LH1@QPlgl*4+cgc8O)%`IoXqGf_M=l0|P@9 YcWz=)c7BenC!_kLFgqT0|P@9 VcWz=)c7B 1: + if len(m) > 0: await self.message(c, (await run("markov '{}'".format(m)))[:-1]) return await self.message(c, 'the oven went boop')