diff options
author | Parker <contact@pkrm.dev> | 2024-03-31 00:12:27 -0500 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-03-31 00:12:27 -0500 |
commit | 9fe16935670c6df38e9ab613b274fa3cf7bb3eaf (patch) | |
tree | d95035416003be71c107ffb60391b92489b84283 /code/cogs/pause.py | |
parent | 4242f1586fb56d155683ebf70ea26d37f0491630 (diff) |
Create `pause` command
Diffstat (limited to 'code/cogs/pause.py')
-rw-r--r-- | code/cogs/pause.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/code/cogs/pause.py b/code/cogs/pause.py new file mode 100644 index 0000000..c231d43 --- /dev/null +++ b/code/cogs/pause.py @@ -0,0 +1,38 @@ +import discord +import datetime +from discord import app_commands +from discord.ext import commands +from cogs.music import Music + +from global_variables import BOT_COLOR + + +class Pause(commands.Cog): + def __init__(self, bot): + self.bot = bot + + + @app_commands.command() + @app_commands.check(Music.create_player) + async def pause(self, interaction: discord.Interaction): + "Pauses the song that is currently playing" + player = self.bot.lavalink.player_manager.get(interaction.guild.id) + + await player.set_pause(pause=True) + embed = discord.Embed( + title=f"Music Now Paused ⏸️", + description=f"**[{player.current.title}]({player.current.uri})**\n\nQueued by: {player.current.requester.mention}", + color=BOT_COLOR, + ) + embed.set_thumbnail(url=player.current.artwork_url) + embed.set_footer( + text=datetime.datetime.now(datetime.timezone.utc).strftime( + "%Y-%m-%d %H:%M:%S" + ) + + " UTC" + ) + await interaction.response.send_message(embed=embed) + + +async def setup(bot): + await bot.add_cog(Pause(bot)) |