set timewait to 1sec
This commit is contained in:
parent
a9e884c4fa
commit
494535800d
1 changed files with 10 additions and 6 deletions
16
cncbot.py
16
cncbot.py
|
@ -58,24 +58,28 @@ class ForestBot(pydle.Client):
|
|||
admin = await self.is_admin(source)
|
||||
if admin:
|
||||
await self.dumplog(target)
|
||||
else:
|
||||
await self.message(target, '] You are NOT an administrator. :('.format(source))
|
||||
|
||||
async def dumplog(self, target):
|
||||
sleep_time = 1
|
||||
while True:
|
||||
msg = self.queue.get()
|
||||
time.sleep(1)
|
||||
await asyncio.sleep(sleep_time)
|
||||
await self.message(target, msg)
|
||||
if len(msg) == 0:
|
||||
break
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
self.queue = kwargs['extqueue']
|
||||
""" Connect and run bot in event loop. """
|
||||
#self.eventloop.run_until_complete(self.connect(*args, **kwargs))
|
||||
self.eventloop.run_until_complete(self.connect(*args))
|
||||
|
||||
loop = self.eventloop
|
||||
#loop.run_until_complete(self.connect(*args, **kwargs))
|
||||
loop.run_until_complete(self.connect(*args))
|
||||
try:
|
||||
self.eventloop.run_forever()
|
||||
loop.run_forever()
|
||||
finally:
|
||||
self.eventloop.stop()
|
||||
loop.stop()
|
||||
|
||||
def CnCApp(queue):
|
||||
botnick = 'cnc_' + get_random_string(8)
|
||||
|
|
Loading…
Reference in a new issue