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)
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)
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)
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)
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())
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())
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._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)
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)