🌐 Updated URLs: - \!help command now points to http://petz.rdx4.com/help - \!pets command now points to http://petz.rdx4.com/player/{nickname} - README.md updated to reference petz.rdx4.com - Web server startup messages show both local and public URLs 🔧 Changes: - modules/core_commands.py: Updated help URL - modules/pet_management.py: Updated player profile URL - webserver.py: Added public URL display in startup messages - README.md: Updated web interface section Users will now receive public URLs that work externally instead of localhost URLs. 🤖 Generated with [Claude Code](https://claude.ai/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://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
|
|
|
|
self.send_message(channel,
|
|
f"📊 {nickname}: Level {player['level']} | {player['experience']} XP | ${player['money']}") |