Ejemplo n.º 1
0
 def main(self, update):
     send_message(
         update.message.chat.identifier,
         'Que imagen quieres guardar?',
         reply_to_message_id=update.message.identifier,
         reply_markup=ForceReply()
     )
     self.bot.conversation = True
     self.bot.current_command = self
Ejemplo n.º 2
0
 def step1(self, update):
     if not hasattr(update.message, 'reply_to_message') or update.message.reply_to_message.identifier != self.message_id:
         print('not the message i was expecting')
         return
     quotes = []
     if self.bot.storage.exists('quotes'):
         quotes = self.bot.storage.get('quotes')
     quotes.append(update.message.text)
     self.bot.storage.save('quotes', quotes)
     send_message(
         update.message.chat.identifier,
         'Almacenada!'
     )
     self.done()
Ejemplo n.º 3
0
 def main(self, update):
     response = send_message(
         update.message.chat.identifier,
         'Que frase quieres guardar?',
         reply_to_message_id=update.message.identifier,
         reply_markup=ForceReply(False)
     )
     self.message_id = response['result']['message_id']
     self.bot.conversation = True
     self.bot.current_command = self
Ejemplo n.º 4
0
 def step1(self, update):
     files = []
     if self.bot.storage.exists('files'):
         files = self.bot.storage.get('files')
     data = dict()
     m = update.message
     print('type', m.type)
     if m.type == 'document':
         data['type'] = m.type
         data['file_id'] = m.document.identifier
         files.append(data)
     elif m.type == 'photo':
         for p in m.photo:
             print(p)
             data['type'] = m.type
             data['file_id'] = p.identifier
             files.append(data)
     self.bot.storage.save('files', files)
     send_message(
         update.message.chat.identifier,
         'Almacenada!'
     )
     self.done()
Ejemplo n.º 5
0
 def main(self, update):
     quotes = []
     if self.bot.storage.exists('quotes'):
         quotes = self.bot.storage.get('quotes')
     send_message(update.message.chat.identifier, choice(quotes))
Ejemplo n.º 6
0
 def main(self, update):
     whom = " ".join(update.message.text.split(" ")[1:])
     if whom == '':
         whom = 'tú!'
     send_message(update.message.chat.identifier, 'hola {}'.format(whom))
Ejemplo n.º 7
0
 def main(self, update):
     status = get_me()
     send_message(update.message.chat.identifier, 'status {}'.format(status['result']))