Exemplo n.º 1
0
def sendWholeMessage(chatId, text):
    chunkSize = 1024
    for i in range(0, len(text), chunkSize):
        msg = sendMessage()
        msg.chat_id = chatId
        msg.text = text[i:i + chunkSize]
        client.post(msg)
Exemplo n.º 2
0
    def test_name(self):
        m = Float()
        self.assertEqual('Float', m._name)

        m = Message()
        self.assertEqual('Message', m._name)

        m = sendMessage()
        self.assertEqual('sendMessage', m._name)
Exemplo n.º 3
0
    def test_name(self):
        m = Float()
        self.assertEqual('Float', m._name)

        m = Message()
        self.assertEqual('Message', m._name)

        m = sendMessage()
        self.assertEqual('sendMessage', m._name)
Exemplo n.º 4
0
 def send_message(self, chat_id, message, keyboard):
     # TODO: Write own library or find good one instead of that
     msg = sendMessage()
     msg.chat_id = chat_id
     msg.text = message
     kb = False
     for row in keyboard:
         if len(row) > 0:
             kb = True
             break
     if kb:
         msg.reply_markup = '{"keyboard": ' + str(keyboard).replace(
             "'", '"') + '}'
     self.client.send_method(msg)
Exemplo n.º 5
0
    def test_basic_assign(self):
        m = sendMessage()
        m.chat_id = 1234
        m.text = 'hello there'

        self.assertEqual(1234, m.chat_id)
        self.assertEqual('hello there', m.text)

        ex = {'chat_id': 1234, 'text': 'hello there'}
        self.assertEquals(ex, m._to_raw())

        m.chat_id = 5678

        ex = {'chat_id': 5678, 'text': 'hello there'}
        self.assertEquals(ex, m._to_raw())
Exemplo n.º 6
0
    def test_basic_assign(self):
        m = sendMessage()
        m.chat_id = 1234
        m.text = 'hello there'

        self.assertEqual(1234, m.chat_id)
        self.assertEqual('hello there', m.text)

        ex = {'chat_id': 1234, 'text': 'hello there'}
        self.assertEquals(ex, m._to_raw())

        m.chat_id = 5678

        ex = {'chat_id': 5678, 'text': 'hello there'}
        self.assertEquals(ex, m._to_raw())
Exemplo n.º 7
0
 def test_send(self):
     m = sendMessage()
     m.chat_id = env.uid
     m.text = "Hi there"
     resp = self._tgclient.post(m)
     print(resp)
Exemplo n.º 8
0
 def test_send(self):
     m = sendMessage()
     m.chat_id = env.uid
     m.text = "Hi there"
     resp = self._tgclient.post(m)
     print(resp)
 def test_send(self):
     m = sendMessage()
     m.chat_id = env.uid
     m.text = "Hi there"
     resp = self._client.send_method(m)
     print(resp)
Exemplo n.º 10
0
 def test_send(self):
     m = sendMessage()
     m.chat_id = env.uid
     m.text = "Hi there"
     resp = yield from self._client.send_method(m)
     print(resp)