password optional (will ask you on bot start if empty), debugging code

This commit is contained in:
Master Kwoth 2016-03-07 14:16:31 +01:00
parent 638ddbd3b1
commit d1dce345fb
6 changed files with 22 additions and 6 deletions

View File

@ -6,6 +6,7 @@ namespace NadekoBot.Classes.JSONModels {
public bool DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true;
public bool IsRotatingStatus { get; set; } = false;
public bool SendPrivateMessageOnMention { get; set; } = false;
public List<string> RotatingStatuses { get; set; } = new List<string>();
public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>();
public HashSet<ulong> ChannelBlacklist { get; set; } = new HashSet<ulong>();

View File

@ -200,21 +200,20 @@ namespace NadekoBot.Classes.Music {
cancelToken.ThrowIfCancellationRequested();
Console.WriteLine($"Prebuffering done? in {waitPerAttempt * bufferAttempts}");
const int blockSize = 3840;
var buffer = new byte[blockSize];
var attempt = 0;
while (!cancelToken.IsCancellationRequested) {
//Console.WriteLine($"Read: {songBuffer.ReadPosition}\nWrite: {songBuffer.WritePosition}\nContentLength:{songBuffer.ContentLength}\n---------");
byte[] buffer = new byte[blockSize];
var read = songBuffer.Read(buffer, blockSize);
if (read == 0)
if (attempt++ == 20) {
Console.WriteLine("Waiting to empty out buffer.");
voiceClient.Wait();
await bufferTask;
Console.WriteLine("Song finished.");
return;
Console.WriteLine($"Song finished. [{songBuffer.ContentLength}]");
break;
}
else
await Task.Delay(50, cancelToken);
await Task.Delay(100, cancelToken);
else
attempt = 0;

View File

@ -269,7 +269,7 @@ Assists: {general["assists"]} Ban: {general["banRate"]}%
await e.Channel.SendMessage(sb.ToString());
} catch (Exception ex) {
await e.Channel.SendMessage($"Fail:\n{ex}");
await e.Channel.SendMessage($":anger: Fail: Champion.gg didsabled ban data until next patch. Sorry for the inconvenience.");
}
});
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Timers;
using System.Threading.Tasks;
using Discord.Commands;
@ -37,6 +38,14 @@ namespace NadekoBot.Commands {
NadekoBot.Client.MessageDeleted += MsgDltd;
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())
// };
}
public Func<CommandEventArgs, Task> DoFunc() => async e => {

View File

@ -50,6 +50,12 @@ namespace NadekoBot {
return;
}
//if password is not entered, prompt for password
if (string.IsNullOrWhiteSpace(Creds.Password)) {
Console.WriteLine("Password blank. Please enter your password:\n");
Creds.Password = Console.ReadLine();
}
Console.WriteLine(string.IsNullOrWhiteSpace(Creds.GoogleAPIKey)
? "No google api key found. You will not be able to use music and links won't be shortened."
: "Google API key provided.");

View File

@ -2,6 +2,7 @@
"DontJoinServers": false,
"ForwardMessages": true,
"IsRotatingStatus": false,
"SendPrivateMessageOnMention": false,
"RotatingStatuses": [],
"ServerBlacklist": [],
"ChannelBlacklist": [],