Increase security and reformat
This commit is contained in:
@@ -38,14 +38,31 @@ def _is_question(text: str) -> bool:
|
||||
if not body:
|
||||
return False
|
||||
low = body.lower()
|
||||
return body.endswith("?") or low.startswith(("what", "why", "how", "when", "where", "who", "can ", "do ", "did ", "is ", "are "))
|
||||
return body.endswith("?") or low.startswith(
|
||||
(
|
||||
"what",
|
||||
"why",
|
||||
"how",
|
||||
"when",
|
||||
"where",
|
||||
"who",
|
||||
"can ",
|
||||
"do ",
|
||||
"did ",
|
||||
"is ",
|
||||
"are ",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _is_group_channel(message: Message) -> bool:
|
||||
channel = str(getattr(message, "source_chat_id", "") or "").strip().lower()
|
||||
if channel.endswith("@g.us"):
|
||||
return True
|
||||
return str(getattr(message, "source_service", "") or "").strip().lower() == "xmpp" and "conference." in channel
|
||||
return (
|
||||
str(getattr(message, "source_service", "") or "").strip().lower() == "xmpp"
|
||||
and "conference." in channel
|
||||
)
|
||||
|
||||
|
||||
async def learn_from_message(message: Message) -> None:
|
||||
|
||||
Reference in New Issue
Block a user