def start_user(self, message: Message): """ Send a welcome message to the user and makes his status active. """ logger.show_msg(message) database = Database() database.start_following(message.chat.id) self.typing(1, message) self.bot.send_message( chat_id=message.from_user.id, parse_mode='Markdown', text="Привет, я помогу тебе отслеживать скидки на книги!\n" "Хочешь добавить книгу?\n" "Просто отправь `ссылку` на неё.")
def ___add_book(self, call): """ Add a book from subscriptions. If the book does not exist in the queue of books to be added, then a message is displayed asking you to repeat. """ database = Database() try: book_ = self.book_to_add[call.message.message_id] database.insert_book(book_, [call.message.chat.id]) database.insert_follower([book_['link']], call) database.start_following(call.message.chat.id) self.book_to_add.pop(call.message.message_id) except KeyError: self.bot.answer_callback_query( callback_query_id=call.id, text='Попробуйте отправить ссылку ещё раз ❌') else: self.bot.answer_callback_query(callback_query_id=call.id, text='Книга добавлена в список ✅')