diff --git a/NadekoBot/Classes/Music/Song.cs b/NadekoBot/Classes/Music/Song.cs index ff0e3f69..8b594e7e 100644 --- a/NadekoBot/Classes/Music/Song.cs +++ b/NadekoBot/Classes/Music/Song.cs @@ -157,10 +157,10 @@ namespace NadekoBot.Classes.Music { return; } if (read == 0) - if (attempt++ == 20) + if (attempt++ == 50) break; else - await Task.Delay(40, cancelToken); + await Task.Delay(100, cancelToken); else attempt = 0; await songBuffer.WriteAsync(buffer, read, cancelToken); @@ -207,7 +207,6 @@ namespace NadekoBot.Classes.Music { var read = songBuffer.Read(buffer, blockSize); if (read == 0) if (attempt++ == 20) { - Console.WriteLine("Waiting to empty out buffer."); voiceClient.Wait(); Console.WriteLine($"Song finished. [{songBuffer.ContentLength}]"); break; @@ -222,7 +221,9 @@ namespace NadekoBot.Classes.Music { buffer = AdjustVolume(buffer, MusicPlayer.Volume); voiceClient.Send(buffer, 0, read); } + Console.WriteLine("Awiting buffer task"); await bufferTask; + Console.WriteLine("Buffer task done."); voiceClient.Clear(); cancelToken.ThrowIfCancellationRequested(); } diff --git a/NadekoBot/Commands/LogCommand.cs b/NadekoBot/Commands/LogCommand.cs index 6779e145..98cf93c9 100644 --- a/NadekoBot/Commands/LogCommand.cs +++ b/NadekoBot/Commands/LogCommand.cs @@ -39,13 +39,22 @@ namespace NadekoBot.Commands { NadekoBot.Client.MessageUpdated += MsgUpdtd; NadekoBot.Client.UserUpdated += UsrUpdtd; - //if (NadekoBot.Config.SendPrivateMessageOnMention) - // NadekoBot.Client.MessageReceived += async (s, e) => { - // if (e.Channel.IsPrivate) - // return; - // if (e.Message.MentionedUsers.Any()) + if (NadekoBot.Config.SendPrivateMessageOnMention) + NadekoBot.Client.MessageReceived += async (s, e) => { + try { + if (e.Channel.IsPrivate) + return; + var usr = e.Message.MentionedUsers.FirstOrDefault(u => u != e.User); + if (usr?.Status != UserStatus.Offline) + return; + await e.Channel.SendMessage($"User `{usr.Name}` is offline. PM sent."); + await usr.SendMessage( + $"User `{e.User.Name}` mentioned you on " + + $"`{e.Server.Name}` server while you were offline.\n" + + $"`Message:` {e.Message.Text}"); - // }; + } catch { } + }; } public Func DoFunc() => async e => { diff --git a/NadekoBot/bin/Debug/data/avatar.png b/NadekoBot/bin/Debug/data/avatar.png index 74ca698b..37862c4b 100644 Binary files a/NadekoBot/bin/Debug/data/avatar.png and b/NadekoBot/bin/Debug/data/avatar.png differ