.move fixed, but it will cancel current song when moving

This commit is contained in:
Master Kwoth 2017-07-02 16:27:30 +02:00
parent b33e4bdd80
commit 322424b0a1
2 changed files with 7 additions and 4 deletions

View File

@ -120,7 +120,7 @@ namespace NadekoBot.Modules.Music
} }
} }
} }
//todo test play
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public Task Play([Remainder]string query = null) public Task Play([Remainder]string query = null)
@ -722,7 +722,7 @@ namespace NadekoBot.Modules.Music
if (mp == null) if (mp == null)
return; return;
//todo test move
mp.SetVoiceChannel(vch); mp.SetVoiceChannel(vch);
} }
@ -886,7 +886,6 @@ namespace NadekoBot.Modules.Music
await ReplyConfirmLocalized("autoplay_enabled").ConfigureAwait(false); await ReplyConfirmLocalized("autoplay_enabled").ConfigureAwait(false);
} }
//todo test output text channel
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageMessages)] [RequireUserPermission(GuildPermission.ManageMessages)]

View File

@ -63,6 +63,7 @@ namespace NadekoBot.Services.Music
private bool manualSkip = false; private bool manualSkip = false;
private bool newVoiceChannel = false;
public MusicPlayer(MusicService musicService, IVoiceChannel vch, ITextChannel output, float volume) public MusicPlayer(MusicService musicService, IVoiceChannel vch, ITextChannel output, float volume)
{ {
@ -200,7 +201,8 @@ namespace NadekoBot.Services.Music
{ {
if (_audioClient == null || if (_audioClient == null ||
_audioClient.ConnectionState != ConnectionState.Connected || _audioClient.ConnectionState != ConnectionState.Connected ||
reconnect) reconnect ||
newVoiceChannel)
try try
{ {
try try
@ -211,6 +213,7 @@ namespace NadekoBot.Services.Music
catch catch
{ {
} }
newVoiceChannel = false;
_audioClient = await VoiceChannel.ConnectAsync(); _audioClient = await VoiceChannel.ConnectAsync();
} }
catch catch
@ -389,6 +392,7 @@ namespace NadekoBot.Services.Music
public void SetVoiceChannel(IVoiceChannel vch) public void SetVoiceChannel(IVoiceChannel vch)
{ {
VoiceChannel = vch; VoiceChannel = vch;
newVoiceChannel = true;
Next(); Next();
} }