first commit

This commit is contained in:
2026-04-29 17:41:10 -05:00
parent f53104d947
commit 0fe6bd7ea6
15 changed files with 1678 additions and 33 deletions

67
bot/commands/music.py Normal file
View File

@@ -0,0 +1,67 @@
"""
music.py - Prefix commands for music playback.
Register:
!play <query> - Download and play a song (adds to queue if already playing)
!skip - Skip current song, play next
!stop - Stop playback, clear queue, leave voice
!queue - Show current queue with details
!nowplaying - Show currently playing track with remaining time
"""
from bot.prefix_command_registry import register_prefix_command
from bot import voice_manager
async def handle_play(message, args):
query = " ".join(args)
if not query:
await message.channel.send("Usage: `!play <song name or URL>`")
return
await voice_manager.resolve_and_enqueue(message, query)
async def handle_skip(message, args):
guild_id = message.guild.id
vc = voice_manager.connections.get(guild_id)
if not vc:
await message.channel.send("Not playing anything.")
return
if not vc.is_playing():
await message.channel.send("Not playing anything.")
return
voice_manager.skip(guild_id)
await message.channel.send("Skipped.")
async def handle_stop(message, args):
guild_id = message.guild.id
vc = voice_manager.connections.get(guild_id)
if not vc:
await message.channel.send("Not playing anything.")
return
voice_manager.stop(guild_id)
await message.channel.send("Stopped and left voice channel.")
async def handle_queue(message, args):
guild_id = message.guild.id
output = voice_manager.get_queue(guild_id)
await message.channel.send(output)
async def handle_nowplaying(message, args):
guild_id = message.guild.id
output = voice_manager.get_now_playing(guild_id)
await message.channel.send(output)
register_prefix_command("play", handle_play)
register_prefix_command("skip", handle_skip)
register_prefix_command("stop", handle_stop)
register_prefix_command("queue", handle_queue)
register_prefix_command("nowplaying", handle_nowplaying)