diff --git a/src/autobioebbing.py b/src/autobioebbing.py index b28cccc..200c5bd 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -90,11 +90,14 @@ def find_infect_theme(text): trying_theme_index = bio_attack_themes.index(theme) logger.debug(f'trying theme {trying_theme_index}...') r, bioexp, days, remaining = re.findall(theme[0], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) - if len(r) > 2 and bioexp and days and remaining: + if r and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}') return r, bio_attack_themes[trying_theme_index] - r = re.findall(theme[0].split('', 1)[1], text) - if len(r) == 1 and bioexp and days and remaining: + for theme in bio_attack_themes: + trying_theme_index = bio_attack_themes.index(theme) + logger.debug(f'trying theme {trying_theme_index} [without first lab]...') + r, bioexp, days, remaining = re.findall(theme[0].split('', 1)[1], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) + if r and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}, but invisible first lab it will be replaced to avocado id') r = [(f'tg://openmessage?user_id={avocado_id}', r[0])] return r, bio_attack_themes[trying_theme_index]