19 lines
514 B
Python
19 lines
514 B
Python
class SharedBuffer:
|
|
def __init__(self, linkedBot):
|
|
self.buf = []
|
|
self.linkedBot = linkedBot
|
|
|
|
def flush(self):
|
|
for msg in self.buf:
|
|
self.linkedBot.send_message(
|
|
mto=msg.split("|")[0],
|
|
mbody=msg.split("|")[1],
|
|
mtype='groupchat')
|
|
self.buf.pop(self.buf.index(msg))
|
|
|
|
def push(self, msg):
|
|
self.buf.append(msg)
|
|
|
|
if len(self.buf) > 0:
|
|
self.flush()
|