MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / checkWeatherWarnings

Method checkWeatherWarnings

weather/weather.ts:477–508  ·  view source on GitHub ↗
(current: any, daily: any)

Source from the content-addressed store, hash-verified

475 const warnings: string[] = [];
476
477 // 极端温度
478 if (current.temperature_2m > 35) {
479 warnings.push(`🔥 高温预警:${current.temperature_2m}°C`);
480 } else if (current.temperature_2m < -10) {
481 warnings.push(`❄️ 低温预警:${current.temperature_2m}°C`);
482 }
483
484 // 强风
485 if (current.wind_speed_10m > 40) {
486 warnings.push(`💨 大风预警:风速 ${current.wind_speed_10m} km/h`);
487 }
488
489 // 强降水
490 if (current.precipitation > 10) {
491 warnings.push(`🌧️ 强降水预警:${current.precipitation} mm`);
492 }
493
494 // 特殊天气
495 const code = current.weather_code;
496 if (code >= 95 && code <= 99) {
497 warnings.push(`⛈️ 雷暴预警:请注意安全`);
498 } else if (code >= 71 && code <= 77) {
499 warnings.push(`🌨️ 降雪预警:路面可能结冰`);
500 } else if (code === 45 || code === 48) {
501 warnings.push(`🌫️ 大雾预警:能见度低`);
502 }
503
504 return warnings;
505 }
506}
507
508export default new WeatherPlugin();

Callers 1

buildWeatherReportMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected