aboutsummaryrefslogtreecommitdiff
path: root/code/cogs/pause.py
blob: fb55aa48e4995296aca54d217f612c49e5715db1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import discord
import datetime
from discord import app_commands
from discord.ext import commands
from cogs.music import Music

from utils.config import create_embed


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 = 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)


async def setup(bot):
    await bot.add_cog(Pause(bot))