def check_time(first_time=False): global dollar_cur, euro_cur if first_time or int(datetime.now().strftime("%H")) == 5: dollar_cur, euro_cur = Parcer.Currency().dollar_currency(), Parcer.Currency().euro_currency() print('Новые значения доллара и евро!') try: for element in my_list_of_time[int(datetime.now().strftime("%H"))]: language = my_session.my_request(message.chat.id).language dollar_now = my_translator.translate(dollar_cur, language) euro_now = my_translator.translate(euro_cur, language) phrase = f"{dollar_now}\n{euro_now}" bot.send_message(element, text=phrase, reply_markup=delete_keyboard) except Exception as exc: print(exc)
def start(message): session = my_session.create_session() if message.chat.id not in list_of_users: chat = tables.Chat() chat.id = message.chat.id chat.language = '1' chat.email = '' session.add(chat) session.commit() list_of_users.append(message.chat.id) user = message.from_user.username language = my_session.my_request(message.chat.id).language if user is None: user = str(my_translator.translate(4, language)) phrase = str(my_translator.translate(1, language)) bot.send_message(message.chat.id, text=str(phrase + ' ' + user + "!"), reply_markup=delete_keyboard)
def email(message): global choose_time, choose_language, write_email language = my_session.my_request(message.chat.id).language choose_language, choose_time, write_email = False, False, True phrase = my_translator.translate(9, language) bot.send_message(message.chat.id, text=phrase, reply_markup=delete_keyboard)