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 DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true; public bool ForwardMessages { get; set; } = true;
public bool IsRotatingStatus { get; set; } = false; public bool IsRotatingStatus { get; set; } = false;
public bool SendPrivateMessageOnMention { get; set; } = false;
public List<string> RotatingStatuses { get; set; } = new List<string>(); public List<string> RotatingStatuses { get; set; } = new List<string>();
public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>(); public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>();
public HashSet<ulong> ChannelBlacklist { 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(); cancelToken.ThrowIfCancellationRequested();
Console.WriteLine($"Prebuffering done? in {waitPerAttempt * bufferAttempts}"); Console.WriteLine($"Prebuffering done? in {waitPerAttempt * bufferAttempts}");
const int blockSize = 3840; const int blockSize = 3840;
var buffer = new byte[blockSize];
var attempt = 0; var attempt = 0;
while (!cancelToken.IsCancellationRequested) { while (!cancelToken.IsCancellationRequested) {
//Console.WriteLine($"Read: {songBuffer.ReadPosition}\nWrite: {songBuffer.WritePosition}\nContentLength:{songBuffer.ContentLength}\n---------"); //Console.WriteLine($"Read: {songBuffer.ReadPosition}\nWrite: {songBuffer.WritePosition}\nContentLength:{songBuffer.ContentLength}\n---------");
byte[] buffer = new byte[blockSize];
var read = songBuffer.Read(buffer, blockSize); var read = songBuffer.Read(buffer, blockSize);
if (read == 0) if (read == 0)
if (attempt++ == 20) { if (attempt++ == 20) {
Console.WriteLine("Waiting to empty out buffer."); Console.WriteLine("Waiting to empty out buffer.");
voiceClient.Wait(); voiceClient.Wait();
await bufferTask; Console.WriteLine($"Song finished. [{songBuffer.ContentLength}]");
Console.WriteLine("Song finished."); break;
return;
} }
else else
await Task.Delay(50, cancelToken); await Task.Delay(100, cancelToken);
else else
attempt = 0; attempt = 0;

View File

@ -269,7 +269,7 @@ Assists: {general["assists"]} Ban: {general["banRate"]}%
await e.Channel.SendMessage(sb.ToString()); await e.Channel.SendMessage(sb.ToString());
} catch (Exception ex) { } 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;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Linq;
using System.Timers; using System.Timers;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord.Commands; using Discord.Commands;
@ -37,6 +38,14 @@ namespace NadekoBot.Commands {
NadekoBot.Client.MessageDeleted += MsgDltd; NadekoBot.Client.MessageDeleted += MsgDltd;
NadekoBot.Client.MessageUpdated += MsgUpdtd; NadekoBot.Client.MessageUpdated += MsgUpdtd;
NadekoBot.Client.UserUpdated += UsrUpdtd; 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 => { public Func<CommandEventArgs, Task> DoFunc() => async e => {

View File

@ -50,6 +50,12 @@ namespace NadekoBot {
return; 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) 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." ? "No google api key found. You will not be able to use music and links won't be shortened."
: "Google API key provided."); : "Google API key provided.");

View File

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