diff --git a/lib/HahaCommands/download.ex b/lib/HahaCommands/download.ex index 23f3244..ec57f0c 100644 --- a/lib/HahaCommands/download.ex +++ b/lib/HahaCommands/download.ex @@ -26,12 +26,12 @@ defmodule HahaYes.Commands.Download do {:ok, loading} = Api.create_message(msg.channel_id, "Downloading...") arg = String.replace(msg.content, "h3h3 download ", "") - opt = ["-f", "bestvideo[height<=?480]+bestaudio/best", arg, "-o", "#{System.tmp_dir}/#{msg.id}", "--force-overwrites", "--playlist-reverse", "--no-playlist", "--remux-video=mp4", "--no-warnings"]; + opt = ["-f", "bestvideo[height<=?480]+bestaudio/best", arg, "-o", "#{System.tmp_dir}/#{msg.id}.%(ext)si", "--force-overwrites", "--playlist-reverse", "--no-playlist", "--remux-video=mp4/webm/mov", "--no-warnings"]; System.cmd("yt-dlp", opt) Api.delete_message(loading.channel_id, loading.id) Api.delete_message(msg) - Api.create_message(msg.channel_id, files: ["#{System.tmp_dir}/#{msg.id}.mp4"]) + Api.create_message(msg.channel_id, files: [Enum.at(Path.wildcard("#{System.tmp_dir}/#{msg.id}.*"), 0)]) end end