发送弹幕“今日天气 北京”、“明日天气 杭州”,查询天气。
格式也可以是“今天”或带“省/市/县”等等,如“今天天气 北京”、“明天天气 杭州市”。
因为自带的“℃”两个符号发不出来,于是两个事件里,分别用了两种新方法来修改格式
直接提取温度数字
去掉“低/高温”和“℃”
注意:v3.7.4及以上版本可用,旧版可选仅发送天气类型(晴雨)
[ { "anchor_key": "神奇弹幕:AutoReply", "enabled": true, "key": "今[日天]天气\\s*(.+)", "reply": ">getData(http://wthrcdn.etouch.cn/weather_mini?city=%$1%, weather_today)" }, { "anchor_key": "神奇弹幕:AutoReply", "enabled": true, "key": "明[日天]天气\\s*(.+)", "reply": ">getData(http://wthrcdn.etouch.cn/weather_mini?city=%$1%, weather_tomorrow)" }, { "action": "%.data.forecast.0.type%,%>replaceReg(%>replace(%.data.forecast.0.low%,℃, )%~%>replace(%.data.forecast.0.high%, ℃,)%, .温\\s*, )%度", "anchor_key": "神奇弹幕:EventAction", "enabled": true, "event": "weather_today" }, { "action": "%.data.forecast.0.type%,%>reg(%.data.forecast.0.low%, \\d+)%~%>reg(%.data.forecast.0.high%, \\d+)%度", "anchor_key": "神奇弹幕:EventAction", "enabled": true, "event": "weather_tomorrow" } ]
以下是天气返回数据示例:
{ "data": { "yesterday": { "date": "15日星期六", "high": "高温 35℃", "fx": "西南风", "low": "低温 22℃", "fl": "<![CDATA[2级]]>", "type": "小雨" }, "city": "杭州", "forecast": [ { "date": "16日星期天", "high": "高温 27℃", "fengli": "<![CDATA[2级]]>", "low": "低温 19℃", "fengxiang": "西北风", "type": "中雨" }, { "date": "17日星期一", "high": "高温 24℃", "fengli": "<![CDATA[2级]]>", "low": "低温 18℃", "fengxiang": "西风", "type": "小雨" }, { "date": "18日星期二", "high": "高温 24℃", "fengli": "<![CDATA[2级]]>", "low": "低温 19℃", "fengxiang": "东南风", "type": "小雨" }, { "date": "19日星期三", "high": "高温 24℃", "fengli": "<![CDATA[1级]]>", "low": "低温 20℃", "fengxiang": "东风", "type": "小雨" }, { "date": "20日星期四", "high": "高温 23℃", "fengli": "<![CDATA[1级]]>", "low": "低温 19℃", "fengxiang": "北风", "type": "大雨" } ], "ganmao": "感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。", "wendu": "25" }, "status": 1000, "desc": "OK" }