def generate_batch(self, chathistory, target):
if len(chathistory) > 0:
# Generate a random alphanumeric BATCH ID
batch_id = ''.join(random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for i in range(BATCH_ID_SIZE))
# Place the BATCH start identifer to the beginning of the chathistory
line = 'irc.znc.in BATCH +{} chathistory {}'.format(batch_id, target)
self.send_chathistory(line)
# Prepend the BATCH ID to each line from the chathistory
for line in chathistory:
#msg_id = uuid.uuid4()
#line = '@batch={};draft/msgid={};{}'.format(batch_id, msg_id, line)
line = '@batch={};{}'.format(batch_id, line)
self.send_chathistory(line)
# Place the BATCH end identifer to the beginning of the chathistory
line = 'irc.znc.in BATCH -{}'.format(batch_id)
self.send_chathistory(line)
else:
client = self.GetClient()
self.send_error(client, 'ERR', 'NOT_FOUND')
# Send the given line to the user
评论列表
文章目录