🎮 Features implemented: - Pokemon-style pet collection and battles - Multi-location exploration system - Dynamic weather with background updates - Achievement system with location unlocks - Web dashboard for player stats - Modular command system - Async database with SQLite - PM flood prevention - Persistent player data 🌤️ Weather System: - 6 weather types with spawn modifiers - 30min-3hour dynamic durations - Background task for automatic updates - Location-specific weather patterns 🐛 Recent Bug Fixes: - Database persistence on restart - Player page SQLite row conversion - Achievement count calculations - Travel requirement messages - Battle move color coding - Locations page display 🔧 Generated with Claude Code 🤖 Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
No EOL
1.8 KiB
Python
44 lines
No EOL
1.8 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://localhost:8080/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
|
|
|
|
self.send_message(channel,
|
|
f"📊 {nickname}: Level {player['level']} | {player['experience']} XP | ${player['money']}") |