mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2025-04-05 00:53:49 +03:00
fix: add caption handle
This commit is contained in:
parent
7c25c7b4a9
commit
4d25d2e83c
@ -133,7 +133,9 @@ class SpamDetectionMiddleware(BaseMiddleware):
|
|||||||
event: "Message",
|
event: "Message",
|
||||||
data: Dict[str, Any],
|
data: Dict[str, Any],
|
||||||
) -> Any:
|
) -> Any:
|
||||||
if USER_STATS_AVAILABLE and event.text:
|
text = event.text or event.caption
|
||||||
|
|
||||||
|
if USER_STATS_AVAILABLE and text:
|
||||||
stats = await get_user_stats(event.chat.id, event.from_user.id)
|
stats = await get_user_stats(event.chat.id, event.from_user.id)
|
||||||
|
|
||||||
verified_users_row = (
|
verified_users_row = (
|
||||||
@ -146,8 +148,8 @@ class SpamDetectionMiddleware(BaseMiddleware):
|
|||||||
|
|
||||||
if verified_users_row:
|
if verified_users_row:
|
||||||
if not verified_users_row["verified"]:
|
if not verified_users_row["verified"]:
|
||||||
if event.text:
|
if text:
|
||||||
is_spam, confidence = spam_predict(event.text)
|
is_spam, confidence = spam_predict(text)
|
||||||
|
|
||||||
log(
|
log(
|
||||||
"message spam confidence",
|
"message spam confidence",
|
||||||
|
@ -79,7 +79,7 @@ class StatisticsMiddleware(BaseMiddleware):
|
|||||||
"new message recieved",
|
"new message recieved",
|
||||||
trace_id=trace_id,
|
trace_id=trace_id,
|
||||||
chat_id=event.chat.id,
|
chat_id=event.chat.id,
|
||||||
message_text=event.text,
|
message_text=event.text or event.caption,
|
||||||
)
|
)
|
||||||
|
|
||||||
data["trace_id"] = trace_id
|
data["trace_id"] = trace_id
|
||||||
|
Loading…
Reference in New Issue
Block a user