aboutsummaryrefslogtreecommitdiff
path: root/code/cogs/pause.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-11-29 01:36:06 -0600
committerParker <contact@pkrm.dev>2024-11-29 01:36:06 -0600
commit4e8030eca4b1f4028268683ccfc7b481b1608dde (patch)
treed208e1c582733bd82993715b9cbc9266aca5390c /code/cogs/pause.py
parente2916fb0aaf5ae7c6306feb7bc13405aabb29ae6 (diff)
Largely embed wording changes + other small tweaks + combine pause commands
Diffstat (limited to 'code/cogs/pause.py')
-rw-r--r--code/cogs/pause.py43
1 files changed, 31 insertions, 12 deletions
diff --git a/code/cogs/pause.py b/code/cogs/pause.py
index fb55aa4..eb3b508 100644
--- a/code/cogs/pause.py
+++ b/code/cogs/pause.py
@@ -1,5 +1,6 @@
import discord
import datetime
+from typing import Literal
from discord import app_commands
from discord.ext import commands
from cogs.music import Music
@@ -12,21 +13,39 @@ class Pause(commands.Cog):
self.bot = bot
@app_commands.command()
+ @app_commands.describe(pause="TRUE to pause, FALSE to unpause")
@app_commands.check(Music.create_player)
- async def pause(self, interaction: discord.Interaction):
- "Pauses the song that is currently playing"
+ async def pause(
+ self, interaction: discord.Interaction, pause: Literal["TRUE", "FALSE"]
+ ):
+ "Pause or unpause the current song"
player = self.bot.lavalink.player_manager.get(interaction.guild.id)
- await player.set_pause(pause=True)
- embed = create_embed(
- title=f"Music Now Paused ⏸️",
- description=(
- f"**[{player.current.title}]({player.current.uri})**\n\nQueued"
- f" by: {player.current.requester.mention}"
- ),
- thumbnail=player.current.artwork_url,
- )
- await interaction.response.send_message(embed=embed)
+ if pause:
+ await player.set_pause(pause=True)
+ embed = create_embed(
+ title=f"Music Paused ⏸️",
+ description=(
+ f"**[{player.current.title}]({player.current.uri})** by"
+ f" {player.current.author}\n\nQueued by:"
+ f" {player.current.requester.mention}"
+ ),
+ thumbnail=player.current.artwork_url,
+ )
+ return await interaction.response.send_message(embed=embed)
+
+ else:
+ await player.set_pause(pause=False)
+ embed = create_embed(
+ title=f"Music Unpaused ▶️",
+ description=(
+ f"**[{player.current.title}]({player.current.uri})** by"
+ f" {player.current.author}\n\nQueued by:"
+ f" {player.current.requester.mention}"
+ ),
+ thumbnail=player.current.artwork_url,
+ )
+ return await interaction.response.send_message(embed=embed)
async def setup(bot):