"""Core plugin: ping, help, version.""" from derp import __version__ from derp.plugin import command @command("ping", help="Check if the bot is alive") async def cmd_ping(bot, message): """Respond with pong.""" await bot.reply(message, "pong") @command("help", help="List commands or show command help") async def cmd_help(bot, message): """Show available commands or help for a specific command. Usage: !help [command] """ parts = message.text.split(None, 2) if len(parts) > 1: # Help for a specific command cmd_name = parts[1].lower().lstrip(bot.prefix) handler = bot.registry.commands.get(cmd_name) if handler: help_text = handler.help or "No help available." await bot.reply(message, f"{bot.prefix}{cmd_name} -- {help_text}") else: await bot.reply(message, f"Unknown command: {cmd_name}") return # List all commands names = sorted(bot.registry.commands.keys()) await bot.reply(message, f"Commands: {', '.join(bot.prefix + n for n in names)}") @command("version", help="Show bot version") async def cmd_version(bot, message): """Report the running version.""" await bot.reply(message, f"derp {__version__}")