Amber/commands.py

28 lines
1.1 KiB
Python
Raw Permalink Normal View History

2025-01-18 21:45:25 -05:00
import discord
from discord import app_commands
from audio import play_audio, stop_audio, set_volume, join_voice, leave_voice
2025-01-18 21:45:25 -05:00
async def setup_commands(client, guild_id=None):
@client.tree.command(name="join", description="Join the user's current voice channel.")
2025-01-18 21:45:25 -05:00
async def join(interaction: discord.Interaction):
await join_voice(interaction)
@client.tree.command(name="leave", description="Leave the current voice channel.")
2025-01-18 21:45:25 -05:00
async def leave(interaction: discord.Interaction):
await leave_voice(interaction)
@client.tree.command(name="play", description="Play a song by title or artist.")
2025-01-18 21:45:25 -05:00
async def play(interaction: discord.Interaction, query: str):
await play_audio(interaction, query)
@client.tree.command(name="stop", description="Stop playback and clear the queue.")
async def stop(interaction: discord.Interaction):
await stop_audio(interaction)
@client.tree.command(name="volume", description="Set playback volume.")
async def volume(interaction: discord.Interaction, level: int):
await set_volume(interaction, level)
2025-01-18 21:45:25 -05:00
await client.tree.sync()