use args
This commit is contained in:
parent
c9bcf00216
commit
00cd071fa9
3 changed files with 4 additions and 5 deletions
|
@ -22,11 +22,10 @@ defmodule HahaYes.Commands.Download do
|
||||||
|
|
||||||
Bot: <video file>
|
Bot: <video file>
|
||||||
"""
|
"""
|
||||||
def execute(msg, _ws_state) do
|
def execute(msg, _ws_state, args) do
|
||||||
{:ok, loading} = Api.create_message(msg.channel_id, "Downloading...")
|
{:ok, loading} = Api.create_message(msg.channel_id, "Downloading...")
|
||||||
|
|
||||||
arg = String.replace(msg.content, "h3h3 download ", "")
|
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"];
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ defmodule HahaYes.Commands.Ping do
|
||||||
Bot: Pong!
|
Bot: Pong!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def execute(msg, _ws_state) do
|
def execute(msg, _ws_state, _args) do
|
||||||
Api.create_message(msg.channel_id, "Pong!")
|
Api.create_message(msg.channel_id, "Pong!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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]))
|
|> then(& apply(String.to_atom("#{HahaYes.Commands}.#{&1}"), :execute, [msg, ws_state, String.replace(msg.content, "h3h3 download ", "")]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue