From 2506f2dea0ead70f7bfd37aec68f8c5ca46c98f0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 1 Oct 2025 17:44:28 +0200 Subject: added playing from file --- cogs/music/play.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cogs') diff --git a/cogs/music/play.py b/cogs/music/play.py index be21702..74b9e4f 100644 --- a/cogs/music/play.py +++ b/cogs/music/play.py @@ -12,6 +12,7 @@ logger = logging.getLogger(__name__) class Play(commands.Cog): def __init__(self, bot): self.bot = bot + self.temp_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "temp") @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") async def play( @@ -57,5 +58,12 @@ class Play(commands.Cog): filename = await play_utils.PlayUtils(self.bot).compress(ctx, filename) await play_utils.PlayUtils(self.bot).play(ctx, filename, title) + @discord.slash_command(name="grajcuj_plik", description="grajcuj plik") + async def play_file(self, ctx: discord.ApplicationContext, attachment: discord.Attachment = discord.Option(discord.Attachment, "co zagrać??", required=True)): + await ctx.defer() + file_path = os.path.join(self.temp_dir, attachment.filename) + await attachment.save(file_path) + await play_utils.PlayUtils(self.bot).play(ctx, file_path) + def setup(bot): bot.add_cog(Play(bot)) \ No newline at end of file -- cgit v1.2.3