waiting buffer process for a longer time
This commit is contained in:
parent
d1dce345fb
commit
1bc681e1aa
@ -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();
|
||||
}
|
||||
|
@ -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<CommandEventArgs, Task> DoFunc() => async e => {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 1.2 MiB |
Loading…
Reference in New Issue
Block a user