Update FlanaBot._on_database_messages
This commit is contained in:
@@ -227,12 +227,14 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
|||||||
users = []
|
users = []
|
||||||
chats = []
|
chats = []
|
||||||
for word in words:
|
for word in words:
|
||||||
|
lower_word = word.lower()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not parsing_users
|
not parsing_users
|
||||||
and
|
and
|
||||||
flanautils.cartesian_product_string_matching(
|
flanautils.cartesian_product_string_matching(
|
||||||
multibot_constants.KEYWORDS['user'],
|
multibot_constants.KEYWORDS['user'],
|
||||||
word,
|
lower_word,
|
||||||
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
@@ -243,7 +245,7 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
|||||||
and
|
and
|
||||||
flanautils.cartesian_product_string_matching(
|
flanautils.cartesian_product_string_matching(
|
||||||
multibot_constants.KEYWORDS['chat'],
|
multibot_constants.KEYWORDS['chat'],
|
||||||
word,
|
lower_word,
|
||||||
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
@@ -255,21 +257,21 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, UberEatsBot, Weathe
|
|||||||
chats.append(flanautils.cast_number(word, raise_exception=False))
|
chats.append(flanautils.cast_number(word, raise_exception=False))
|
||||||
elif platform_matches := flanautils.cartesian_product_string_matching(
|
elif platform_matches := flanautils.cartesian_product_string_matching(
|
||||||
(element.name.lower() for element in Platform),
|
(element.name.lower() for element in Platform),
|
||||||
word,
|
lower_word,
|
||||||
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
||||||
):
|
):
|
||||||
platforms.extend(Platform[key.upper()] for key in platform_matches)
|
platforms.extend(Platform[key.upper()] for key in platform_matches)
|
||||||
elif is_group := bool(flanautils.cartesian_product_string_matching(
|
elif flanautils.cartesian_product_string_matching(
|
||||||
multibot_constants.KEYWORDS['group'],
|
multibot_constants.KEYWORDS['group'],
|
||||||
word,
|
lower_word,
|
||||||
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
||||||
)):
|
):
|
||||||
is_group = True
|
is_group = True
|
||||||
elif is_private := bool(flanautils.cartesian_product_string_matching(
|
elif flanautils.cartesian_product_string_matching(
|
||||||
multibot_constants.KEYWORDS['private'],
|
multibot_constants.KEYWORDS['private'],
|
||||||
word,
|
word,
|
||||||
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
multibot_constants.PARSER_MIN_SCORE_DEFAULT
|
||||||
)):
|
):
|
||||||
is_private = True
|
is_private = True
|
||||||
elif (number := flanautils.cast_number(word, raise_exception=False)) != word:
|
elif (number := flanautils.cast_number(word, raise_exception=False)) != word:
|
||||||
n_messages += number
|
n_messages += number
|
||||||
|
|||||||
Reference in New Issue
Block a user