aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/play.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-01-15 14:37:22 +0100
committersalmonik <raisersoft@proton.me>2026-01-15 14:37:22 +0100
commitedff41f3468996dad5e66d34ac8ab1f5a238751f (patch)
tree33a567cd202fedf010764c3e4b8cae8827851f7f /cogs/music/play.py
parentasyncio issues when starting (diff)
downloadsenator-sperma-edff41f3468996dad5e66d34ac8ab1f5a238751f.tar.gz
senator-sperma-edff41f3468996dad5e66d34ac8ab1f5a238751f.zip
minor improvements
Diffstat (limited to 'cogs/music/play.py')
-rw-r--r--cogs/music/play.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cogs/music/play.py b/cogs/music/play.py
index 2c5b641..d77d772 100644
--- a/cogs/music/play.py
+++ b/cogs/music/play.py
@@ -1,11 +1,12 @@
1import os 1import os
2import discord 2import discord
3import mutagen 3import mutagen
4from typing import List, Tuple, Optional, Callable, Awaitable, Union 4from typing import List, Tuple, Callable, Awaitable
5from os import PathLike
5 6
6from . import play_utils 7from cogs.music import play_utils
7from discord.ext import commands 8from discord.ext import commands
8from discord.commands import Option, OptionChoice 9from discord.commands import OptionChoice
9import logging 10import logging
10 11
11logger = logging.getLogger(__name__) 12logger = logging.getLogger(__name__)
@@ -16,7 +17,8 @@ class Play(commands.Cog):
16 self.temp_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "temp") 17 self.temp_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "temp")
17 self.path_mapping = {} # Maps display names to full paths 18 self.path_mapping = {} # Maps display names to full paths
18 19
19 async def _create_search_embed(self, candidates: List[str]) -> Tuple[discord.Embed, discord.ui.View]: 20 @staticmethod
21 async def _create_search_embed(candidates: List[str]) -> Tuple[discord.Embed, discord.ui.View]:
20 """Create an embed and view for search results.""" 22 """Create an embed and view for search results."""
21 embed = discord.Embed( 23 embed = discord.Embed(
22 title="Wyniki wyszukiwania", 24 title="Wyniki wyszukiwania",
@@ -204,7 +206,7 @@ class Play(commands.Cog):
204 @discord.slash_command(name="grajcuj_plik", description="grajcuj plik") 206 @discord.slash_command(name="grajcuj_plik", description="grajcuj plik")
205 async def play_file(self, ctx: discord.ApplicationContext, attachment: discord.Attachment = discord.Option(discord.Attachment, "co zagrać??", required=True)): 207 async def play_file(self, ctx: discord.ApplicationContext, attachment: discord.Attachment = discord.Option(discord.Attachment, "co zagrać??", required=True)):
206 await ctx.defer() 208 await ctx.defer()
207 file_path = os.path.join(self.temp_dir, attachment.filename) 209 file_path: PathLike[str] | str = os.path.join(self.temp_dir, attachment.filename)
208 await attachment.save(file_path) 210 await attachment.save(file_path)
209 await play_utils.PlayUtils(self.bot).play(ctx, file_path) 211 await play_utils.PlayUtils(self.bot).play(ctx, file_path)
210 212