From 58fb37296a9ad64a7a29b951628a116283348ed8 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Tue, 24 Dec 2024 02:05:36 +0900 Subject: [PATCH] #3 --- queries_to_answers.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/queries_to_answers.py b/queries_to_answers.py index f1e5fd7..68c8670 100644 --- a/queries_to_answers.py +++ b/queries_to_answers.py @@ -4,10 +4,10 @@ import random from datetime import datetime from typing import TypedDict -from .config import DB -from .consts import AnswerType, Character, Platform -from .models import Answer, AnsweredFlag, Query, User -from .talk import Talk +from nizika_ai.config import DB +from nizika_ai.consts import AnswerType, Character, Platform +from nizika_ai.models import Answer, AnsweredFlag, Query, User +from nizika_ai.talk import Talk def main ( @@ -60,10 +60,14 @@ def add_answer ( def add_answered_flags ( answer: Answer, ) -> None: - print (answer.answer_type) - if answer.answer_type in [AnswerType.YOUTUBE_REPLY]: + answer_type: AnswerType + try: + answer_type = AnswerType (answer.answer_type) + except Exception: + return + if answer_type in [AnswerType.YOUTUBE_REPLY]: add_answered_flag (answer, Platform.YOUTUBE) - if answer.answer_type in [AnswerType.BLUESKY_REPLY]: + if answer_type in [AnswerType.BLUESKY_REPLY]: add_answered_flag (answer, Platform.BLUESKY)