Spaces:
Sleeping
Sleeping
Update command_handler.py
Browse files- command_handler.py +5 -1
command_handler.py
CHANGED
|
@@ -9,7 +9,8 @@ from cwa_service import fetch_cwa_alarm_list, fetch_significant_earthquakes, fet
|
|
| 9 |
from usgs_service import fetch_global_last24h_text, fetch_taiwan_df_this_year
|
| 10 |
from ai_service import generate_ai_text
|
| 11 |
from config import CURRENT_YEAR, MCP_SERVER_URL
|
| 12 |
-
from pws_service import fetch_cwa_pws_earthquake_info
|
|
|
|
| 13 |
|
| 14 |
def get_help_message() -> TextMessage:
|
| 15 |
"""產生並回傳包含所有指令的說明文字,並附上英文翻譯。"""
|
|
@@ -37,6 +38,8 @@ def get_help_message() -> TextMessage:
|
|
| 37 |
"• 8 - 關於此機器人 (About this Bot)\n"
|
| 38 |
"• 9 - 顯示此說明 (Show this Help Message)\n\n"
|
| 39 |
"【其他服務 (Other Services)】\n"
|
|
|
|
|
|
|
| 40 |
"• 11 - 查詢最近地震PWS訊息\n"
|
| 41 |
" (Recent PWS Earthquake Info)"
|
| 42 |
)
|
|
@@ -111,6 +114,7 @@ def process_message(user_message_raw: str, request_base_url: str) -> list:
|
|
| 111 |
if command_key == '6': return [TextMessage(text=fetch_significant_earthquakes(limit=5))]
|
| 112 |
if command_key == '8': return [get_info_message()]
|
| 113 |
if command_key == '9': return [get_help_message()]
|
|
|
|
| 114 |
if command_key == '11': return [TextMessage(text=fetch_cwa_pws_earthquake_info())]
|
| 115 |
|
| 116 |
if command_key == '7':
|
|
|
|
| 9 |
from usgs_service import fetch_global_last24h_text, fetch_taiwan_df_this_year
|
| 10 |
from ai_service import generate_ai_text
|
| 11 |
from config import CURRENT_YEAR, MCP_SERVER_URL
|
| 12 |
+
from pws_service import fetch_cwa_pws_earthquake_info
|
| 13 |
+
from news_service import fetch_today_news # 匯入新函式
|
| 14 |
|
| 15 |
def get_help_message() -> TextMessage:
|
| 16 |
"""產生並回傳包含所有指令的說明文字,並附上英文翻譯。"""
|
|
|
|
| 38 |
"• 8 - 關於此機器人 (About this Bot)\n"
|
| 39 |
"• 9 - 顯示此說明 (Show this Help Message)\n\n"
|
| 40 |
"【其他服務 (Other Services)】\n"
|
| 41 |
+
"• 10 - 查詢今日新聞\n"
|
| 42 |
+
" (Today's News)\n"
|
| 43 |
"• 11 - 查詢最近地震PWS訊息\n"
|
| 44 |
" (Recent PWS Earthquake Info)"
|
| 45 |
)
|
|
|
|
| 114 |
if command_key == '6': return [TextMessage(text=fetch_significant_earthquakes(limit=5))]
|
| 115 |
if command_key == '8': return [get_info_message()]
|
| 116 |
if command_key == '9': return [get_help_message()]
|
| 117 |
+
if command_key == '10': return [TextMessage(text=fetch_today_news())]
|
| 118 |
if command_key == '11': return [TextMessage(text=fetch_cwa_pws_earthquake_info())]
|
| 119 |
|
| 120 |
if command_key == '7':
|