Petbot/modules/core_commands.py
megaproxy 5ac3e36f0c Add unified navigation bar to all webserver pages
- Implemented comprehensive navigation system with hover dropdowns
- Added navigation to all webserver pages for consistent user experience
- Enhanced page templates with unified styling and active page highlighting
- Improved accessibility and discoverability of all bot features through web interface

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 16:59:16 +01:00

47 lines
No EOL
2 KiB
Python

#!/usr/bin/env python3
"""Core commands module for PetBot"""
from .base_module import BaseModule
class CoreCommands(BaseModule):
"""Handles basic bot commands like start, help, stats"""
def get_commands(self):
return ["help", "start", "stats"]
async def handle_command(self, channel, nickname, command, args):
if command == "help":
await self.cmd_help(channel, nickname)
elif command == "start":
await self.cmd_start(channel, nickname)
elif command == "stats":
await self.cmd_stats(channel, nickname, args)
async def cmd_help(self, channel, nickname):
"""Send help URL to prevent rate limiting"""
self.send_message(channel, f"{nickname}: Complete command reference available at: http://petz.rdx4.com/help")
async def cmd_start(self, channel, nickname):
"""Start a new player"""
player = await self.get_player(nickname)
if player:
self.send_message(channel, f"{nickname}: You already have an account! Use !team to see your pets.")
return
player_id = await self.database.create_player(nickname)
starter_pet = await self.game_engine.give_starter_pet(player_id)
self.send_message(channel,
f"🎉 {nickname}: Welcome to the world of pets! You received a Level {starter_pet['level']} {starter_pet['species_name']}! You are now in Starter Town.")
async def cmd_stats(self, channel, nickname, args):
"""Show player statistics"""
player = await self.require_player(channel, nickname)
if not player:
return
# Show quick summary and direct to web interface for detailed stats
self.send_message(channel,
f"📊 {nickname}: Level {player['level']} | {player['experience']} XP | ${player['money']}")
self.send_message(channel,
f"🌐 View detailed statistics at: http://petz.rdx4.com/player/{nickname}#stats")