From e86d9829b0bd89f62c48797857a0d955d2958938 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 27 Jul 2023 17:22:06 +0300 Subject: [PATCH] do not mix IMDB and KP in one post --- src/fmn_database.py | 1 - src/fmn_poll.py | 5 ++--- src/fmn_states_db.py | 1 + src/listener_context.py | 4 ++++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fmn_database.py b/src/fmn_database.py index d6f6b72..b600f0d 100644 --- a/src/fmn_database.py +++ b/src/fmn_database.py @@ -113,4 +113,3 @@ def reset_poll(): '''Сброс содержимого предложки-опроса''' c.execute("DELETE FROM poll") conn.commit() - diff --git a/src/fmn_poll.py b/src/fmn_poll.py index 2b584a8..973d5a6 100644 --- a/src/fmn_poll.py +++ b/src/fmn_poll.py @@ -41,7 +41,7 @@ def create_poll_movies(text=text_create_poll(), poll_expires=345600): attaches = [upload_attachment('src/FMN.webp')] except Exception as E: logger.error(f"attachements can't do upload: {E}") - + poll_status_id = post_status(text, None, formated_poll_options, poll_expires=poll_expires, attachments=attaches) logger.success('Голосовалка создана') @@ -62,7 +62,7 @@ def get_winner_movie(poll_status_id=str): for option in poll['options']: votes_count = option['votes_count'] votes_counters.append(votes_count) - + write_votes(votes_counters) voted_movies = read_votes() max_vote = voted_movies[0][4] @@ -108,4 +108,3 @@ def create_tie_breaker(count_tie=1): else: poll_expires = 4*60*60 tie_poll = create_poll_movies("TIE BREAKER!!!\n\nВыбираем из победителей!", poll_expires) - diff --git a/src/fmn_states_db.py b/src/fmn_states_db.py index d0a0fac..8385614 100644 --- a/src/fmn_states_db.py +++ b/src/fmn_states_db.py @@ -3,6 +3,7 @@ from loguru import logger states_file = 'fmn_states.json' + class states_stor: states = None diff --git a/src/listener_context.py b/src/listener_context.py index 986a2dc..680dabb 100644 --- a/src/listener_context.py +++ b/src/listener_context.py @@ -104,6 +104,10 @@ def scan_context_thread(): message_writer = [] success = False + if parsed_result and parsed_result_imdb: + post_status('❌ Не смешивайте IMDB и кинопоиск в одном посте, пожалуйста.', id_st) + fail_limit[acct] += 1 + continue if parsed_result is not None: print(parsed_result) suggested_movies = get_kinopoisk_movie_to_imdb(parsed_result)