Initial commit: Complete PetBot IRC Game
🎮 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>
This commit is contained in:
commit
47f160a295
31 changed files with 6235 additions and 0 deletions
43
modules/base_module.py
Normal file
43
modules/base_module.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Base module class for PetBot command modules"""
|
||||
|
||||
import asyncio
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class BaseModule(ABC):
|
||||
"""Base class for all PetBot modules"""
|
||||
|
||||
def __init__(self, bot, database, game_engine):
|
||||
self.bot = bot
|
||||
self.database = database
|
||||
self.game_engine = game_engine
|
||||
|
||||
@abstractmethod
|
||||
def get_commands(self):
|
||||
"""Return list of commands this module handles"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def handle_command(self, channel, nickname, command, args):
|
||||
"""Handle a command for this module"""
|
||||
pass
|
||||
|
||||
def send_message(self, target, message):
|
||||
"""Send message through the bot"""
|
||||
self.bot.send_message(target, message)
|
||||
|
||||
def send_pm(self, nickname, message):
|
||||
"""Send private message to user"""
|
||||
self.bot.send_message(nickname, message)
|
||||
|
||||
async def get_player(self, nickname):
|
||||
"""Get player from database"""
|
||||
return await self.database.get_player(nickname)
|
||||
|
||||
async def require_player(self, channel, nickname):
|
||||
"""Get player or send start message if not found"""
|
||||
player = await self.get_player(nickname)
|
||||
if not player:
|
||||
self.send_message(channel, f"{nickname}: Use !start to begin your journey first!")
|
||||
return None
|
||||
return player
|
||||
Loading…
Add table
Add a link
Reference in a new issue