restoring lost work

This commit is contained in:
Master Kwoth 2017-11-28 16:11:38 +07:00
parent 6e5fd672ea
commit e266489076
2 changed files with 8 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Music.Common
private readonly Thread _player; private readonly Thread _player;
public IVoiceChannel VoiceChannel { get; private set; } public IVoiceChannel VoiceChannel { get; private set; }
private readonly ITextChannel _originalTextChannel; public ITextChannel OriginalTextChannel { get; set; }
private readonly Logger _log; private readonly Logger _log;
private MusicQueue Queue { get; } = new MusicQueue(); private MusicQueue Queue { get; } = new MusicQueue();
@ -140,12 +140,16 @@ namespace NadekoBot.Modules.Music.Common
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
this.Volume = volume; this.Volume = volume;
this.VoiceChannel = vch; this.VoiceChannel = vch;
this._originalTextChannel = original; this.OriginalTextChannel = original;
this.SongCancelSource = new CancellationTokenSource(); this.SongCancelSource = new CancellationTokenSource();
if(ms.MusicChannelId is ulong cid) if(ms.MusicChannelId is ulong cid)
{ {
this.OutputTextChannel = ((SocketGuild)original.Guild).GetTextChannel(cid) ?? original; this.OutputTextChannel = ((SocketGuild)original.Guild).GetTextChannel(cid) ?? original;
} }
else
{
this.OutputTextChannel = original;
}
this._musicService = musicService; this._musicService = musicService;
this._google = google; this._google = google;
@ -666,7 +670,7 @@ namespace NadekoBot.Modules.Music.Common
public void SetMusicChannelToOriginal() public void SetMusicChannelToOriginal()
{ {
this.OutputTextChannel = _originalTextChannel; this.OutputTextChannel = OriginalTextChannel;
} }
//// this should be written better //// this should be written better

View File

@ -921,7 +921,7 @@ namespace NadekoBot.Modules.Music
{ {
var mp = await _service.GetOrCreatePlayer(Context); var mp = await _service.GetOrCreatePlayer(Context);
mp.OutputTextChannel = null; mp.OutputTextChannel = mp.OriginalTextChannel;
_service.SetMusicChannel(Context.Guild.Id, null); _service.SetMusicChannel(Context.Guild.Id, null);
await ReplyConfirmLocalized("unset_music_channel").ConfigureAwait(false); await ReplyConfirmLocalized("unset_music_channel").ConfigureAwait(false);