Merge pull request #206 from gwigz/master

"!m pl" adjusted to ignore command if missing parameter
This commit is contained in:
Master Kwoth 2016-04-10 22:15:03 +02:00
commit 2a04ac7c9f

View File

@ -252,12 +252,15 @@ namespace NadekoBot.Modules
.Parameter("playlist", ParameterType.Unparsed) .Parameter("playlist", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {
var arg = e.GetArg("playlist");
if (string.IsNullOrWhiteSpace(arg))
return;
if (e.User.VoiceChannel?.Server != e.Server) if (e.User.VoiceChannel?.Server != e.Server)
{ {
await e.Channel.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it."); await e.Channel.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.");
return; return;
} }
var ids = await SearchHelper.GetVideoIDs(await SearchHelper.GetPlaylistIdByKeyword(e.GetArg("playlist"))); var ids = await SearchHelper.GetVideoIDs(await SearchHelper.GetPlaylistIdByKeyword(arg));
//todo TEMPORARY SOLUTION, USE RESOLVE QUEUE IN THE FUTURE //todo TEMPORARY SOLUTION, USE RESOLVE QUEUE IN THE FUTURE
var idArray = ids as string[] ?? ids.ToArray(); var idArray = ids as string[] ?? ids.ToArray();
var count = idArray.Count(); var count = idArray.Count();
@ -281,11 +284,11 @@ namespace NadekoBot.Modules
.Do(async e => .Do(async e =>
{ {
var arg = e.GetArg("directory"); var arg = e.GetArg("directory");
if (string.IsNullOrWhiteSpace(e.GetArg("directory"))) if (string.IsNullOrWhiteSpace(arg))
return; return;
try try
{ {
var fileEnum = System.IO.Directory.EnumerateFiles(e.GetArg("directory")).Take(50); var fileEnum = System.IO.Directory.EnumerateFiles(arg).Take(50);
foreach (var file in fileEnum) foreach (var file in fileEnum)
{ {
await QueueSong(e.Channel, e.User.VoiceChannel, file, true, MusicType.Local); await QueueSong(e.Channel, e.User.VoiceChannel, file, true, MusicType.Local);