refactor message flow on purposes
Browse files- app/message_processor.py +13 -12
app/message_processor.py
CHANGED
|
@@ -125,18 +125,19 @@ class MessageProcessor:
|
|
| 125 |
logger.error(f"No access token found for page {message_data['page_id']}")
|
| 126 |
return
|
| 127 |
# Gửi message Facebook, nếu lỗi token expired thì invalidate và thử lại một lần
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
| 140 |
|
| 141 |
# Extract command and keywords
|
| 142 |
from app.utils import extract_command, extract_keywords
|
|
|
|
| 125 |
logger.error(f"No access token found for page {message_data['page_id']}")
|
| 126 |
return
|
| 127 |
# Gửi message Facebook, nếu lỗi token expired thì invalidate và thử lại một lần
|
| 128 |
+
# Tạm comment vào để test đã
|
| 129 |
+
# try:
|
| 130 |
+
# await self.facebook.send_message(message=get_random_message(PROCESSING_STATUS_MESSAGES))
|
| 131 |
+
# except Exception as e:
|
| 132 |
+
# if "expired" in str(e).lower():
|
| 133 |
+
# logger.warning("[FACEBOOK] Token expired, invalidate and refresh")
|
| 134 |
+
# self.channel.invalidate_page_token()
|
| 135 |
+
# page_token = self.channel.get_page_token(force_refresh=True)
|
| 136 |
+
# # Có thể update lại page_token cho self.facebook nếu cần
|
| 137 |
+
# self.facebook.page_token = page_token
|
| 138 |
+
# # await self.facebook.send_message(message="Ok, để mình check. Bạn chờ mình chút xíu nhé!")
|
| 139 |
+
# else:
|
| 140 |
+
# raise
|
| 141 |
|
| 142 |
# Extract command and keywords
|
| 143 |
from app.utils import extract_command, extract_keywords
|