Ejemplo n.º 1
0
 def start(self, msg=True):
     if msg:
         self.send_all(self.cfg["start_message"])
     utils.new_message(msg=self.cfg['default_message'],
                       repl=self.cfg['message_repl'],
                       db_name=self.cfg["db_name"])
     self.bot.polling()
Ejemplo n.º 2
0
 def manage(self, message, text=None):
     self.bot.send_message(
         message.chat.id,
         text=utils.new_message(
             msg=text if text else self.cfg['default_message'],
             db_name=self.cfg["db_name"],
             repl=self.cfg['message_repl']),
         reply_markup=utils.inline_markup(self.markup))
Ejemplo n.º 3
0
 def revert(self, call):
     id = call.message.chat.id
     messages = utils.new_message(index=self.index,
                                  msg=self.cfg['default_message'],
                                  repl=self.cfg['message_repl'],
                                  db_name=self.cfg["db_name"])
     self.bot.delete_message(id, call.message.message_id)
     self.bot.send_message(id,
                           text=messages,
                           reply_markup=utils.inline_markup(self.markup))
     self.bot.answer_callback_query(call.id, "Success")
Ejemplo n.º 4
0
    def next(self, call):
        utils.class_db.index += utils.STEP

        messages = utils.new_message(msg=self.cfg['default_message'],
                                     repl=self.cfg['message_repl'],
                                     index=utils.class_db.index,
                                     db_name=self.cfg["db_name"])
        self.bot.edit_message_text(text=messages,
                                   chat_id=call.message.chat.id,
                                   message_id=call.message.message_id,
                                   reply_markup=utils.inline_markup(
                                       self.markup),
                                   inline_message_id=call.inline_message_id)
Ejemplo n.º 5
0
    def prev(self, call):
        utils.class_db.index -= utils.STEP
        if utils.class_db.index < 0:
            utils.class_db.index = 0
            self.bot.answer_callback_query(call.id, self.cfg['no_films_error'])
            return True

        message = utils.new_message(msg=self.cfg['default_message'],
                                    repl=self.cfg['message_repl'],
                                    index=utils.class_db.index,
                                    db_name=self.cfg["db_name"])
        self.bot.edit_message_text(text=message,
                                   chat_id=call.message.chat.id,
                                   message_id=call.message.message_id,
                                   reply_markup=utils.inline_markup(
                                       self.markup),
                                   inline_message_id=call.inline_message_id)
Ejemplo n.º 6
0
def new_message(message):
    if message.chat.id != config.group_id:
        config.the_bot.forward_message(config.group_id, message.chat.id,
                                       message.message_id)
    utils.new_message(message)