Пример #1
0
 def history_cb(self, msg_count, chat, success, msgs):
     if success:
         self.insert_history(msgs)
         msg_count += len(msgs)
         if len(msgs) == self.HISTORY_QUERY_SIZE:
             tgl.get_history(chat, msg_count,
                             self.HISTORY_QUERY_SIZE,
                             partial(self.history_cb, msg_count, chat))
         else:
             tgl.send_msg(chat, "Loaded {0} messaged into the table".format(msg_count))
Пример #2
0
 def aux(success, dest):
     text_max = 4096
     tlen = len(text)
     nmsg = math.ceil(tlen / text_max)
     if nmsg <= 1:
         receiver.send_msg(text, ok_cb)
     else:
         ntext = text[:text_max]
         rest = text[text_max:]
         f = _send_large_msg_callback_aux(receiver, rest)
         tgl.send_msg(receiver, ntext, f, True)