21 lines
828 B
Python
21 lines
828 B
Python
import discord
|
|
from discord import app_commands
|
|
from audio import join_voice, leave_voice, play_audio
|
|
|
|
|
|
async def setup_commands(client):
|
|
@client.tree.command(name="join", description="Amber joins the voice channel you're in.")
|
|
async def join(interaction: discord.Interaction):
|
|
await join_voice(interaction)
|
|
|
|
@client.tree.command(name="leave", description="Amber leaves the current voice channel.")
|
|
async def leave(interaction: discord.Interaction):
|
|
await leave_voice(interaction)
|
|
|
|
@client.tree.command(name="play", description="Search and play a song by name or YouTube URL.")
|
|
@app_commands.describe(query="The name or YouTube URL of the song.")
|
|
async def play(interaction: discord.Interaction, query: str):
|
|
await play_audio(interaction, query)
|
|
|
|
await client.tree.sync()
|