Files
meshcore-bot/modules/commands/solar_command.py

39 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Solar Command - Provides solar conditions and HF band information
"""
from .base_command import BaseCommand
from ..solar_conditions import solar_conditions, hf_band_conditions
from ..models import MeshMessage
class SolarCommand(BaseCommand):
"""Command to get solar conditions"""
# Plugin metadata
name = "solar"
keywords = ['solar']
description = "Get solar conditions and HF band status"
category = "solar"
def __init__(self, bot):
super().__init__(bot)
async def execute(self, message: MeshMessage) -> bool:
"""Execute the solar command"""
try:
# Get solar conditions (more readable format)
solar_info = solar_conditions()
# Send response (solar only, more readable)
response = f"☀️ Solar: {solar_info}"
# Use the unified send_response method
return await self.send_response(message, response)
except Exception as e:
error_msg = f"Error getting solar info: {e}"
await self.send_response(message, error_msg)
return False