/// <summary>Method called when OnTrackStarted event is fired. /// </summary> private async Task OnTrackStarted(TrackStartEventArgs arg) { var textChannel = arg.Player.TextChannel; var track = arg.Track; /* Send "Now Playing" message to text channel, and delete it after the music ends * (this prevents bot spamming "Now playing" messages when queue is long) */ _interactivityService.DelayedSendMessageAndDeleteAsync(textChannel, deleteDelay: track.Duration, embed: await CustomFormats.NowPlayingEmbed(track)); }
/// <summary>Gets currently playing song and returns an embed with it. /// </summary> public async Task <Embed> NowPlayingAsync(IGuild guild) { if (!_lavaNode.HasPlayer(guild)) { return(CustomFormats.CreateErrorEmbed("Could not acquire player.")); } var player = _lavaNode.GetPlayer(guild); return(player?.Track == null ? CustomFormats.CreateErrorEmbed("No music playing.") : await CustomFormats.NowPlayingEmbed(player.Track, true)); }