first commit
This commit is contained in:
40
bot/prefix_command_registry.py
Normal file
40
bot/prefix_command_registry.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
prefix_command_registry.py - Module registration for prefix commands
|
||||
|
||||
Same pattern as command_registry.py, but for !command-style handlers
|
||||
in the command text channel. No AI, no session, no auth.
|
||||
|
||||
Handler signature: async def handler(message, args) -> None
|
||||
message: discord.Message object
|
||||
args: list of strings (everything after the command name)
|
||||
"""
|
||||
|
||||
PREFIX_COMMANDS = {}
|
||||
|
||||
|
||||
def register_prefix_command(name, handler):
|
||||
"""
|
||||
Register a handler for a prefix command.
|
||||
|
||||
Args:
|
||||
name: String key (e.g., 'play', 'skip', 'queue')
|
||||
handler: Async function(message, args) -> None
|
||||
|
||||
Example:
|
||||
async def handle_play(message, args):
|
||||
query = " ".join(args)
|
||||
# ... search YouTube, join voice, play ...
|
||||
|
||||
register_prefix_command('play', handle_play)
|
||||
"""
|
||||
PREFIX_COMMANDS[name] = handler
|
||||
|
||||
|
||||
def get_prefix_handler(name):
|
||||
"""Get the registered handler for a prefix command name."""
|
||||
return PREFIX_COMMANDS.get(name)
|
||||
|
||||
|
||||
def list_prefix_commands():
|
||||
"""List all registered prefix command names."""
|
||||
return list(PREFIX_COMMANDS.keys())
|
||||
Reference in New Issue
Block a user