diff options
| -rw-r--r-- | cogs/music/play.py | 8 |
1 files changed, 8 insertions, 0 deletions
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__) | |||
| 12 | class Play(commands.Cog): | 12 | class Play(commands.Cog): |
| 13 | def __init__(self, bot): | 13 | def __init__(self, bot): |
| 14 | self.bot = bot | 14 | self.bot = bot |
| 15 | self.temp_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "temp") | ||
| 15 | 16 | ||
| 16 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") | 17 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") |
| 17 | async def play( | 18 | async def play( |
| @@ -57,5 +58,12 @@ class Play(commands.Cog): | |||
| 57 | filename = await play_utils.PlayUtils(self.bot).compress(ctx, filename) | 58 | filename = await play_utils.PlayUtils(self.bot).compress(ctx, filename) |
| 58 | await play_utils.PlayUtils(self.bot).play(ctx, filename, title) | 59 | await play_utils.PlayUtils(self.bot).play(ctx, filename, title) |
| 59 | 60 | ||
| 61 | @discord.slash_command(name="grajcuj_plik", description="grajcuj plik") | ||
| 62 | async def play_file(self, ctx: discord.ApplicationContext, attachment: discord.Attachment = discord.Option(discord.Attachment, "co zagrać??", required=True)): | ||
| 63 | await ctx.defer() | ||
| 64 | file_path = os.path.join(self.temp_dir, attachment.filename) | ||
| 65 | await attachment.save(file_path) | ||
| 66 | await play_utils.PlayUtils(self.bot).play(ctx, file_path) | ||
| 67 | |||
| 60 | def setup(bot): | 68 | def setup(bot): |
| 61 | bot.add_cog(Play(bot)) \ No newline at end of file | 69 | bot.add_cog(Play(bot)) \ No newline at end of file |
