updated music commands

This commit is contained in:
2022-07-10 21:57:22 +03:00
parent 2dae8a3a63
commit 3f67d7f3f9
2 changed files with 3 additions and 9 deletions

Binary file not shown.

View File

@@ -16,7 +16,7 @@ internal class Play : DBCommand
public string Description => "Play music from a file"; public string Description => "Play music from a file";
public string Usage => "fplay [name/url]"; public string Usage => "play [name/url]";
public bool canUseDM => false; public bool canUseDM => false;
@@ -33,14 +33,8 @@ internal class Play : DBCommand
return; return;
do do
{ {
if (splitted.Length == 2) if (splitted.Length == 2 && splitted[1].Contains("youtube.com") || splitted[1].Contains("youtu.be"))
{ {
if (!splitted[1].Contains("youtube.com"))
{
await context.Channel.SendMessageAsync("Invalid link");
return;
}
var url = splitted[1]; var url = splitted[1];
path += $"{Functions.CreateMD5(url)}"; path += $"{Functions.CreateMD5(url)}";
if (File.Exists(path)) if (File.Exists(path))
@@ -108,7 +102,7 @@ internal class Play : DBCommand
using (var ffmpegOutputBaseStream = ffmpeg.StandardOutput.BaseStream) using (var ffmpegOutputBaseStream = ffmpeg.StandardOutput.BaseStream)
{ {
await Data.MusicPlayer.Play(ffmpegOutputBaseStream, 1024); await Data.MusicPlayer.Play(ffmpegOutputBaseStream, 1024);
Console.WriteLine("Finished playing from" + nowPlaying.Name); Console.WriteLine("Finished playing from " + nowPlaying.Url);
} }
} }