28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
import discord
|
|
from discord import app_commands
|
|
from audio import play_audio, stop_audio, set_volume, join_voice, leave_voice
|
|
|
|
|
|
async def setup_commands(client, guild_id=None):
|
|
@client.tree.command(name="join", description="Join the user's current voice channel.")
|
|
async def join(interaction: discord.Interaction):
|
|
await join_voice(interaction)
|
|
|
|
@client.tree.command(name="leave", description="Leave the current voice channel.")
|
|
async def leave(interaction: discord.Interaction):
|
|
await leave_voice(interaction)
|
|
|
|
@client.tree.command(name="play", description="Play a song by title or artist.")
|
|
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)
|
|
|
|
await client.tree.sync()
|