feat: Implement city risk profile data collection and integrate it into the bot listener.
This commit is contained in:
+28
-8
@@ -155,15 +155,35 @@ def start_bot():
|
|||||||
return
|
return
|
||||||
|
|
||||||
city_input = parts[1].strip().lower()
|
city_input = parts[1].strip().lower()
|
||||||
|
|
||||||
|
# --- 12城核心别名映射表 (Polymarket 标准) ---
|
||||||
city_aliases = {
|
city_aliases = {
|
||||||
"nyc": "new york", "ny": "new york", "la": "los angeles",
|
# 韩国
|
||||||
"chi": "chicago", "atl": "atlanta", "sea": "seattle",
|
"sel": "seoul", "seo": "seoul", "首尔": "seoul",
|
||||||
"dal": "dallas", "mia": "miami", "tor": "toronto",
|
# 英国
|
||||||
"ank": "ankara", "sel": "seoul", "wel": "wellington",
|
"lon": "london", "伦敦": "london",
|
||||||
"ba": "buenos aires", "伦敦": "london", "纽约": "new york",
|
# 加拿大
|
||||||
"西雅图": "seattle", "芝加哥": "chicago", "多伦多": "toronto",
|
"tor": "toronto", "多伦多": "toronto",
|
||||||
"首尔": "seoul", "惠灵顿": "wellington", "达拉斯": "dallas",
|
# 土耳其
|
||||||
"亚特兰大": "atlanta"
|
"ank": "ankara", "安卡拉": "ankara",
|
||||||
|
# 新西兰
|
||||||
|
"wel": "wellington", "惠灵顿": "wellington",
|
||||||
|
# 阿根廷
|
||||||
|
"ba": "buenos aires", "布宜诺斯艾利斯": "buenos aires",
|
||||||
|
|
||||||
|
# 美国 (华氏度区)
|
||||||
|
"nyc": "new york", "ny": "new york", "纽约": "new york",
|
||||||
|
"chi": "chicago", "芝加哥": "chicago",
|
||||||
|
"sea": "seattle", "西雅图": "seattle",
|
||||||
|
"mia": "miami", "迈阿密": "miami",
|
||||||
|
"atl": "atlanta", "亚特兰大": "atlanta",
|
||||||
|
"dal": "dallas", "达拉斯": "dallas",
|
||||||
|
"hou": "houston", "休斯顿": "houston",
|
||||||
|
"bos": "boston", "波士顿": "boston",
|
||||||
|
"phi": "philadelphia", "费城": "philadelphia",
|
||||||
|
"pho": "phoenix", "凤凰城": "phoenix",
|
||||||
|
"san": "san francisco", "旧金山": "san francisco",
|
||||||
|
"la": "los angeles", "洛杉矶": "los angeles",
|
||||||
}
|
}
|
||||||
city_name = city_aliases.get(city_input, city_input)
|
city_name = city_aliases.get(city_input, city_input)
|
||||||
|
|
||||||
|
|||||||
@@ -158,36 +158,7 @@ def get_city_risk_profile(city_name: str) -> dict:
|
|||||||
"""获取城市的风险档案"""
|
"""获取城市的风险档案"""
|
||||||
city_lower = city_name.lower().strip()
|
city_lower = city_name.lower().strip()
|
||||||
|
|
||||||
# 别名映射
|
city_key = city_lower
|
||||||
aliases = {
|
|
||||||
"nyc": "new york",
|
|
||||||
"ny": "new york",
|
|
||||||
"chi": "chicago",
|
|
||||||
"atl": "atlanta",
|
|
||||||
"sea": "seattle",
|
|
||||||
"dal": "dallas",
|
|
||||||
"mia": "miami",
|
|
||||||
"tor": "toronto",
|
|
||||||
"ank": "ankara",
|
|
||||||
"sel": "seoul",
|
|
||||||
"seo": "seoul",
|
|
||||||
"wel": "wellington",
|
|
||||||
"ba": "buenos aires",
|
|
||||||
"首尔": "seoul",
|
|
||||||
"芝加哥": "chicago",
|
|
||||||
"纽约": "new york",
|
|
||||||
"伦敦": "london",
|
|
||||||
"达拉斯": "dallas",
|
|
||||||
"迈阿密": "miami",
|
|
||||||
"亚特兰大": "atlanta",
|
|
||||||
"西雅图": "seattle",
|
|
||||||
"多伦多": "toronto",
|
|
||||||
"惠灵顿": "wellington",
|
|
||||||
"安卡拉": "ankara",
|
|
||||||
"布宜诺斯艾利斯": "buenos aires",
|
|
||||||
}
|
|
||||||
|
|
||||||
city_key = aliases.get(city_lower, city_lower)
|
|
||||||
return CITY_RISK_PROFILES.get(city_key)
|
return CITY_RISK_PROFILES.get(city_key)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user