diff --git a/.gitignore b/.gitignore index 718f59f..8f0c647 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,4 @@ docs/local/ tests/ test_scripts/ dev/ +website/ diff --git a/modules/command_manager.py b/modules/command_manager.py index 9b1e3c3..8be5fda 100644 --- a/modules/command_manager.py +++ b/modules/command_manager.py @@ -294,19 +294,31 @@ class CommandManager: # Check if message starts with any help keyword for help_keyword in help_keywords: - if content_lower.startswith(help_keyword + ' '): - command_name = content_lower[len(help_keyword):].strip() # Remove help keyword prefix - help_text = self.get_help_for_command(command_name, message) - # Format the help response with message data (same as other keywords) - help_text = self.format_keyword_response(help_text, message) - matches.append(('help', help_text)) - return matches - elif content_lower == help_keyword: - help_text = self.get_general_help() - # Format the help response with message data (same as other keywords) - help_text = self.format_keyword_response(help_text, message) - matches.append(('help', help_text)) - return matches + if content_lower.startswith(help_keyword + ' ') or content_lower == help_keyword: + # Check channel restrictions for help keyword (same as other keywords/commands) + # DMs are allowed if respond_to_dms is enabled + if message.is_dm: + if not self.bot.config.getboolean('Channels', 'respond_to_dms', fallback=True): + break # DMs disabled, skip help keyword + else: + # For channel messages, check if channel is in monitor_channels + if message.channel not in self.monitor_channels: + break # Channel not monitored, skip help keyword + + # Channel check passed, process help request + if content_lower.startswith(help_keyword + ' '): + command_name = content_lower[len(help_keyword):].strip() # Remove help keyword prefix + help_text = self.get_help_for_command(command_name, message) + # Format the help response with message data (same as other keywords) + help_text = self.format_keyword_response(help_text, message) + matches.append(('help', help_text)) + return matches + elif content_lower == help_keyword: + help_text = self.get_general_help() + # Format the help response with message data (same as other keywords) + help_text = self.format_keyword_response(help_text, message) + matches.append(('help', help_text)) + return matches # Check all loaded plugins for matches for command_name, command in self.commands.items(): @@ -339,6 +351,16 @@ class CommandManager: if any(keyword.lower() in [k.lower() for k in cmd.keywords] for cmd in self.commands.values()): continue + # Check channel restrictions for plain keywords (same as commands) + # DMs are allowed if respond_to_dms is enabled + if message.is_dm: + if not self.bot.config.getboolean('Channels', 'respond_to_dms', fallback=True): + continue # DMs disabled, skip this keyword + else: + # For channel messages, check if channel is in monitor_channels + if message.channel not in self.monitor_channels: + continue # Channel not monitored, skip this keyword + keyword_lower = keyword.lower() # Check for exact match first diff --git a/modules/commands/base_command.py b/modules/commands/base_command.py index 470a9d7..2ba2d88 100644 --- a/modules/commands/base_command.py +++ b/modules/commands/base_command.py @@ -30,6 +30,11 @@ class BaseCommand(ABC): cooldown_seconds: int = 0 category: str = "general" + # Documentation fields - to be overridden by subclasses for website generation + usage: str = "" # Usage syntax, e.g., "wx [tomorrow|7d|hourly|alerts]" + examples: List[str] = [] # Example commands, e.g., ["wx 98101", "wx seattle tomorrow"] + parameters: List[Dict[str, str]] = [] # Parameter definitions, e.g., [{"name": "location", "description": "US zip code or city name"}] + def __init__(self, bot): self.bot = bot self.logger = bot.logger diff --git a/website/index.html b/website/index.html index 11d5c42..7356ecf 100644 --- a/website/index.html +++ b/website/index.html @@ -519,6 +519,43 @@ font-size: 0.95rem; } + .command-subcommands { + margin-top: 1rem; + padding-top: 1rem; + border-top: 1px solid var(--border-subtle); + } + + .subcommands-header { + font-size: 0.85rem; + font-weight: 600; + color: var(--text-muted); + margin-bottom: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.05em; + } + + .subcommand-item { + display: flex; + gap: 0.75rem; + margin-bottom: 0.5rem; + font-size: 0.9rem; + align-items: flex-start; + } + + .subcommand-name { + font-family: 'JetBrains Mono', monospace; + color: var(--accent-cyan); + font-weight: 500; + min-width: 100px; + flex-shrink: 0; + } + + .subcommand-desc { + color: var(--text-secondary); + flex: 1; + line-height: 1.5; + } + .command-channels { color: var(--accent-cyan); font-size: 0.85rem; @@ -804,6 +841,7 @@
  • Entertainment
  • Fun Commands
  • Games & Entertainment
  • +
  • General Commands
  • Mesh Network Info
  • Solar & Astronomical
  • Sports
  • @@ -939,6 +977,18 @@

    Fun Commands

    +
    +
    +

    dadjoke

    +
    + dad joke + dadjokes + dad jokes +
    +
    +

    Get a random dad joke from icanhazdadjoke.com

    +
    Channel: #jokes
    +

    hacker

    @@ -953,18 +1003,6 @@

    Simulates hacking a supervillain's mainframe with hilarious error messages

    -
    -
    -

    dadjoke

    -
    - dad joke - dadjokes - dad jokes -
    -
    -

    Get a random dad joke from icanhazdadjoke.com

    -
    Channel: #jokes
    -
    @@ -990,6 +1028,23 @@
    +
    +

    General Commands

    +
    +
    +
    +

    airplanes

    +
    + aircraft + planes + adsb + overhead +
    +
    +

    Get aircraft overhead (usage: airplanes [location] [options] or overhead [lat,lon])

    +
    +
    +

    Mesh Network Info

    @@ -1034,30 +1089,30 @@

    Get HF band conditions for ham radio

    -
    -
    -

    satpass

    -
    -

    Get satellite pass info: satpass <NORAD_number_or_shortcut> [visual]

    -

    moon

    Get moon phase, rise/set times and position

    -
    -
    -

    sun

    -
    -

    Get sunrise/sunset times

    -

    solar

    Get current solar conditions and HF band info

    +
    +
    +

    satpass

    +
    +

    Get satellite pass info: satpass <NORAD_number_or_shortcut> [visual]

    +
    +
    +
    +

    sun

    +
    +

    Get sunrise/sunset times

    +

    solarforecast

    @@ -1099,6 +1154,16 @@

    Get weather information for a zip code (usage: wx 12345)

    +
    +
    +

    gwx

    +
    + globalweather + gwxa +
    +
    +

    Get weather information for any global location (usage: gwx Tokyo)

    +

    aqi

    @@ -1110,16 +1175,6 @@

    Get Air Quality Index for a location (usage: aqi seattle, aqi greenwood, aqi vancouver canada, aqi 47.6,-122.3, or aqi help)

    -
    -
    -

    gwx

    -
    - globalweather - gwxa -
    -
    -

    Get weather information for any global location (usage: gwx Tokyo)

    -