dj-embe/cog/music.py
2023-04-28 01:19:18 +02:00

36 lines
1.0 KiB
Python

from discord import Bot, Cog, ApplicationContext
from discord.commands import slash_command
from entity import Entry
from logging import Logger
from service import QueueManager
from usecase import Sources
class Music(Cog):
def __init__(
self, bot: Bot, logger: Logger, queueManager: QueueManager, sources: Sources
):
self.bot = bot
self.logger = logger
self.queueManager = queueManager
self.sources = sources
@slash_command(name="play")
async def play(self, context: ApplicationContext, query: str):
async with self.queueManager(context.guild_id) as queue:
test = await self.sources.processQuery(query)
queue.add(
Entry(
title="title",
artist="artist",
album="album",
thumbnail="thumb",
link="fdsdfsd",
requesterId=context.author.id,
)
)
await context.respond(str(test))