.die should now stop all music players, #1329
This commit is contained in:
		@@ -15,6 +15,7 @@ using Microsoft.EntityFrameworkCore;
 | 
				
			|||||||
using NadekoBot.Services.Administration;
 | 
					using NadekoBot.Services.Administration;
 | 
				
			||||||
using System.Diagnostics;
 | 
					using System.Diagnostics;
 | 
				
			||||||
using NadekoBot.DataStructures;
 | 
					using NadekoBot.DataStructures;
 | 
				
			||||||
 | 
					using NadekoBot.Services.Music;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace NadekoBot.Modules.Administration
 | 
					namespace NadekoBot.Modules.Administration
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -29,14 +30,16 @@ namespace NadekoBot.Modules.Administration
 | 
				
			|||||||
            private readonly SelfService _service;
 | 
					            private readonly SelfService _service;
 | 
				
			||||||
            private readonly DiscordSocketClient _client;
 | 
					            private readonly DiscordSocketClient _client;
 | 
				
			||||||
            private readonly IImagesService _images;
 | 
					            private readonly IImagesService _images;
 | 
				
			||||||
 | 
					            private readonly MusicService _music;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            public SelfCommands(DbService db, SelfService service, DiscordSocketClient client,
 | 
					            public SelfCommands(DbService db, SelfService service, DiscordSocketClient client,
 | 
				
			||||||
                IImagesService images)
 | 
					                MusicService music, IImagesService images)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                _db = db;
 | 
					                _db = db;
 | 
				
			||||||
                _service = service;
 | 
					                _service = service;
 | 
				
			||||||
                _client = client;
 | 
					                _client = client;
 | 
				
			||||||
                _images = images;
 | 
					                _images = images;
 | 
				
			||||||
 | 
					                _music = music;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            [NadekoCommand, Usage, Description, Aliases]
 | 
					            [NadekoCommand, Usage, Description, Aliases]
 | 
				
			||||||
@@ -268,6 +271,7 @@ namespace NadekoBot.Modules.Administration
 | 
				
			|||||||
                    // ignored
 | 
					                    // ignored
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                await Task.Delay(2000).ConfigureAwait(false);
 | 
					                await Task.Delay(2000).ConfigureAwait(false);
 | 
				
			||||||
 | 
					                try { await _music.DestroyAllPlayers().ConfigureAwait(false); } catch { }
 | 
				
			||||||
                Environment.Exit(0);
 | 
					                Environment.Exit(0);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -272,6 +272,14 @@ namespace NadekoBot.Services.Music
 | 
				
			|||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public async Task DestroyAllPlayers()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            foreach (var key in MusicPlayers.Keys)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                await DestroyPlayer(key);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<SongInfo> ResolveYoutubeSong(string query, string queuerName)
 | 
					        public async Task<SongInfo> ResolveYoutubeSong(string query, string queuerName)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var link = (await _google.GetVideoLinksByKeywordAsync(query).ConfigureAwait(false)).FirstOrDefault();
 | 
					            var link = (await _google.GetVideoLinksByKeywordAsync(query).ConfigureAwait(false)).FirstOrDefault();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user