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