diff --git a/requirements.txt b/requirements.txt index c37f5d5..a802077 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ discord==2.3 ffmpeg-python==0.2 -stringprogressbar==1.1 +stringprogressbar==1.1.1 pynacl==1.5 yt-dlp==2024.8.6 diff --git a/src/main.py b/src/main.py index c7f468e..7f32e87 100644 --- a/src/main.py +++ b/src/main.py @@ -88,14 +88,14 @@ async def play(ctx, *, query: str = None): if ctx.message.attachments: success_list = [] notice = await ctx.send(":arrow_double_up: Uploading...", suppress_embeds=True) - success_string = ":white_check_mark: Successfully uploaded: \n" + success_string = "File Status: \n" for song in ctx.message.attachments: filename, thumbname = utils.getFileNames(server_id) # Make sure the file is either audio or video filetype = song.content_type if filetype is None or (filetype.split('/')[0] != "audio" and filetype.split('/')[0] != "video"): - await notice.edit(content=":no_entry_sign: Not a valid video or audio file...") + success_string += ":no_entry_sign: — `" + song.filename + "`, invalid file!\n" continue # Save the song to the temp folder @@ -105,10 +105,11 @@ async def play(ctx, *, query: str = None): item = utils.parseMediaFile(song, filename, thumbname) success_list.append(item["name"]); - success_string += " –`" + item["name"] + "`\n" + success_string += ":white_check_mark: — `" + item["name"] + "`\n" await notice.edit(content=success_string) server_info[server_id]["queue"].append(item) + print(str(server_id) + " | " + f"Uploaded {song.filename}") if len(success_list) > 0: await notice.edit(content=success_string, delete_after=3) @@ -261,7 +262,6 @@ async def play(ctx, *, query: str = None): # Create embed embed=discord.Embed(title="▶️ Playing: " + song_name, url=song_url, description=song_desc, color=color) - if song_thumb is not None: embed.set_thumbnail(url="attachment://" + song_thumbname) elif song_thumb_url is not None: @@ -274,6 +274,13 @@ async def play(ctx, *, query: str = None): ) await playing.edit(embed=embed) + embed = discord.Embed(title=":stop_button: Finished Playing: " + song_name, url=song_url, description=song_desc, color=color) + if song_thumb is not None: + embed.set_thumbnail(url="attachment://" + song_thumbname) + elif song_thumb_url is not None: + embed.set_thumbnail(url=song_thumb_url) + await playing.edit(embed=embed) + server_info[server_id]["elapsed"] = 0 if not server_info[server_id]["loop"]: # Increment the queue position by 1 @@ -305,7 +312,7 @@ async def play(ctx, *, query: str = None): @bot.command() -async def skip(ctx, direction = None, number = None): +async def skip(ctx, command = None, number = None): # Get all the id and channel info server_id, voice_channel, user_voice_channel = await utils.getIds(ctx) @@ -324,11 +331,11 @@ async def skip(ctx, direction = None, number = None): pass # Check which direction the user asked to skip - if direction is None or direction == "forward" or direction.isnumeric(): + if command is None or command == "forward" or command.isnumeric(): try: - if direction.isnumeric(): - if int(direction) > 0: - server_info[server_id]["queue_position"] += int(direction) - 1 + if command.isnumeric(): + if int(command) > 0: + server_info[server_id]["queue_position"] += int(command) - 1 except: pass if number != None and number > 0: @@ -336,7 +343,7 @@ async def skip(ctx, direction = None, number = None): # Stop the audio playback voice_channel.stop() - elif direction == "back" and not server_info[server_id]["queue_position"] == 0: + elif command == "back" and not server_info[server_id]["queue_position"] == 0: # Decrement the queue position back = 2 @@ -349,8 +356,8 @@ async def skip(ctx, direction = None, number = None): # Stop the audio playback of the current track voice_channel.stop() - elif direction == "to" and number is not None: - server_info[server_id]["queue_position"] = number - 1 + elif command == "to" and number is not None: + server_info[server_id]["queue_position"] = number voice_channel.stop() elif server_info[server_id]["queue_position"] == 0: diff --git a/src/utils.py b/src/utils.py index 23d2b3f..aa108f7 100644 --- a/src/utils.py +++ b/src/utils.py @@ -70,7 +70,6 @@ def parseMediaFile(discord_file, tmp_filename: str, tmp_thumbname: str): thumbnail = tmp_thumbname color_thief = ColorThief(thumbnail) color = color_thief.get_color(quality=1) - print(color) else: thumbnail = "assets/unknown.png"