Merge pull request #6 from ZR2/master

Now playing command, more music info
This commit is contained in:
Master Kwoth 2016-01-23 17:28:09 +01:00
commit 7d460e4f73

View File

@ -138,6 +138,15 @@ namespace NadekoBot.Modules {
await e.Send(string.Join("\n", player.SongQueue.Select(v => v.Title).Take(10)));
});
cgb.CreateCommand("np")
.Alias("playing")
.Description("Shows the song currently playing.")
.Do(e => {
if (musicPlayers.ContainsKey(e.Server) == false) return;
var player = musicPlayers[e.Server];
e.Send($"Now Playing **{player.CurrentSong.Title}**");
});
cgb.CreateCommand("clrbfr")
.Alias("clearbuffers")
.Description("Clears the music buffer across all servers. **Owner only.**")
@ -233,10 +242,11 @@ namespace NadekoBot.Modules {
StartBuffering();
LinkResolved = true;
Channel.Send(":musical_note: **Queued** " + video.Title);
Channel.Send($"{User.Mention}, Queued **{video.Title}**");
} catch (Exception e) {
// Send a message to the guy that queued that
Channel.SendMessage(":warning: Something went wrong...");
Channel.SendMessage("This video is unavailable in the country the Bot is running in, or you enter an invalid name or url.");
Console.WriteLine("Cannot parse youtube url: " + query);
Cancel();
}
@ -598,7 +608,7 @@ namespace NadekoBot.Modules {
return;
// Start streaming to voice
await streamRequest.Channel.SendMessage($":musical_note: Playing {streamRequest.Title}");
await streamRequest.Channel.SendMessage($"Playing **{streamRequest.Title}** [{streamRequest.Length}]");
var audioService = client.Audio();
voiceClient = await audioService.Join(streamRequest.VoiceChannel);
@ -638,6 +648,7 @@ namespace NadekoBot.Modules {
Console.WriteLine("Exception while playing music: " + ex);
} finally {
if (voiceClient != null) {
await streamRequest.Channel.SendMessage($"Finished playing **{streamRequest.Title}**");
State = StreamTaskState.Completed;
streamer?.Cancel();
await voiceClient.Disconnect();