meshai/meshai/commands/fire_cmd.py
zvx-echo6 2255ca5803 feat(env): NIFC fire perimeters + avalanche advisories
- WFIGS ArcGIS fire perimeter polling with proximity alerts
- Avalanche.org advisory polling (seasonal, SNFAC)
- !fire and !avy commands
- Distance-based severity for fires near mesh infrastructure
- Dashboard environment page integration
- Alert engine fires on fires within 50km of mesh area

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 15:22:07 -06:00

40 lines
1.2 KiB
Python

"""Fire command handler."""
from .base import CommandContext, CommandHandler
class FireCommand(CommandHandler):
"""Active wildfire information."""
name = "fire"
description = "Active wildfires in the area"
usage = "!fire"
def __init__(self, env_store):
self._env_store = env_store
async def execute(self, args: str, context: CommandContext) -> str:
"""Execute the fire command."""
if not self._env_store:
return "Environmental feeds not enabled."
fires = self._env_store.get_active(source="nifc")
if not fires:
return "No active wildfires in the area."
lines = [f"Active Wildfires ({len(fires)}):"]
for f in fires[:5]:
name = f.get("name", "Unknown")
acres = f.get("acres", 0)
pct = f.get("pct_contained", 0)
dist = f.get("distance_km")
anchor = f.get("nearest_anchor")
line = f"* {name} -- {int(acres):,} ac, {int(pct)}% contained"
if dist is not None and anchor:
line += f" ({int(dist)} km from {anchor})"
lines.append(line)
return "\n".join(lines)