Compare commits

..

No commits in common. "00cd071fa933f801422642f7d98bda811f729079" and "08c6505530b872c069f6ce045f41118177759478" have entirely different histories.

3 changed files with 6 additions and 5 deletions

View file

@ -22,10 +22,11 @@ defmodule HahaYes.Commands.Download do
Bot: <video file> Bot: <video file>
""" """
def execute(msg, _ws_state, args) do def execute(msg) do
{:ok, loading} = Api.create_message(msg.channel_id, "Downloading...") {:ok, loading} = Api.create_message(msg.channel_id, "Downloading...")
opt = ["-f", "bestvideo[height<=?480]+bestaudio/best", args, "-o", "#{System.tmp_dir}/#{msg.id}.%(ext)si", "--force-overwrites", "--playlist-reverse", "--no-playlist", "--remux-video=mp4/webm/mov", "--no-warnings"]; arg = String.replace(msg.content, "h3h3 download ", "")
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) System.cmd("yt-dlp", opt)

View file

@ -15,7 +15,7 @@ defmodule HahaYes.Commands.Ping do
Bot: Pong! Bot: Pong!
""" """
def execute(msg, _ws_state, _args) do def execute(msg) do
Api.create_message(msg.channel_id, "Pong!") Api.create_message(msg.channel_id, "Pong!")
end end
end end

View file

@ -5,7 +5,7 @@ defmodule HahaYes.Events.MessagesConsumer do
use Nostrum.Consumer use Nostrum.Consumer
def handle_event({:MESSAGE_CREATE, msg, ws_state}) when msg.author.bot != true do def handle_event({:MESSAGE_CREATE, msg, _ws_state}) when msg.author.bot != true do
if String.starts_with?(msg.content, "h3h3 ") do if String.starts_with?(msg.content, "h3h3 ") do
msg.content msg.content
|> String.replace("h3h3 ", "") |> String.replace("h3h3 ", "")
@ -13,7 +13,7 @@ defmodule HahaYes.Events.MessagesConsumer do
|> Enum.at(0) |> Enum.at(0)
|> String.downcase() |> String.downcase()
|> String.capitalize() |> String.capitalize()
|> then(& apply(String.to_atom("#{HahaYes.Commands}.#{&1}"), :execute, [msg, ws_state, String.replace(msg.content, "h3h3 download ", "")])) |> then(& apply(String.to_atom("#{HahaYes.Commands}.#{&1}"), :execute, [msg]))
end end
end end
end end