More cleanup, removed parse completely...
This commit is contained in:
parent
34989ae9f4
commit
f61606f8bc
@ -1,6 +1,5 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Parse;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -36,7 +35,7 @@ namespace NadekoBot
|
|||||||
_statsSW.Start();
|
_statsSW.Start();
|
||||||
_service.CommandExecuted += StatsCollector_RanCommand;
|
_service.CommandExecuted += StatsCollector_RanCommand;
|
||||||
|
|
||||||
StartCollecting();
|
Task.Run(() => StartCollecting());
|
||||||
Console.WriteLine("Logging enabled.");
|
Console.WriteLine("Logging enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,8 @@
|
|||||||
public string BotMention;
|
public string BotMention;
|
||||||
public string GoogleAPIKey;
|
public string GoogleAPIKey;
|
||||||
public ulong OwnerID;
|
public ulong OwnerID;
|
||||||
public string ParseID;
|
|
||||||
public string ParseKey;
|
|
||||||
public string TrelloAppKey;
|
public string TrelloAppKey;
|
||||||
public bool? ForwardMessages;
|
public bool? ForwardMessages;
|
||||||
public string OsuApiKey;
|
|
||||||
public string SoundCloudClientID;
|
public string SoundCloudClientID;
|
||||||
public string MashapeKey;
|
public string MashapeKey;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ namespace NadekoBot.Commands {
|
|||||||
var task = Classes.DBHandler.Instance.GetAllRows<Classes._DataModels.Request>();
|
var task = Classes.DBHandler.Instance.GetAllRows<Classes._DataModels.Request>();
|
||||||
|
|
||||||
string str = "Here are all current requests for NadekoBot:\n\n";
|
string str = "Here are all current requests for NadekoBot:\n\n";
|
||||||
int i = 1;
|
|
||||||
foreach (var reqObj in task) {
|
foreach (var reqObj in task) {
|
||||||
str += $"{reqObj.Id}. by **{reqObj.UserName}** from **{reqObj.ServerName}** at {reqObj.DateAdded.ToLocalTime()}\n" +
|
str += $"{reqObj.Id}. by **{reqObj.UserName}** from **{reqObj.ServerName}** at {reqObj.DateAdded.ToLocalTime()}\n" +
|
||||||
$"**{reqObj.RequestText}**\n----------\n";
|
$"**{reqObj.RequestText}**\n----------\n";
|
||||||
|
@ -7,7 +7,6 @@ using Discord.Commands;
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Parse;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
/* Voltana's legacy
|
/* Voltana's legacy
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Parse;
|
|
||||||
|
|
||||||
namespace NadekoBot.Commands {
|
namespace NadekoBot.Commands {
|
||||||
|
|
||||||
public static class SentencesProvider {
|
public static class SentencesProvider {
|
||||||
internal static string GetRandomSentence() {
|
internal static string GetRandomSentence() {
|
||||||
var data = new ParseQuery<ParseObject>("TypingArticles").FindAsync().Result;
|
var data = Classes.DBHandler.Instance.GetAllRows<Classes._DataModels.TypingArticle>();
|
||||||
try {
|
try {
|
||||||
return data.ToList()[(new Random()).Next(0, data.Count())].Get<string>("text");
|
return data.ToList()[new Random().Next(0, data.Count())].Text;
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
return "Failed retrieving data from parse. Owner didn't add any articles to type using `typeadd`.";
|
return "Failed retrieving data from parse. Owner didn't add any articles to type using `typeadd`.";
|
||||||
}
|
}
|
||||||
@ -131,8 +128,7 @@ namespace NadekoBot.Commands {
|
|||||||
private Func<CommandEventArgs, Task> QuitFunc() =>
|
private Func<CommandEventArgs, Task> QuitFunc() =>
|
||||||
async e => {
|
async e => {
|
||||||
if (runningContests.ContainsKey(e.User.Server.Id) &&
|
if (runningContests.ContainsKey(e.User.Server.Id) &&
|
||||||
await runningContests[e.User.Server.Id].Stop())
|
await runningContests[e.User.Server.Id].Stop()) {
|
||||||
{
|
|
||||||
runningContests.Remove(e.User.Server.Id);
|
runningContests.Remove(e.User.Server.Id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,13 +147,15 @@ namespace NadekoBot.Commands {
|
|||||||
cgb.CreateCommand("typeadd")
|
cgb.CreateCommand("typeadd")
|
||||||
.Description("Adds a new article to the typing contest. Owner only.")
|
.Description("Adds a new article to the typing contest. Owner only.")
|
||||||
.Parameter("text", ParameterType.Unparsed)
|
.Parameter("text", ParameterType.Unparsed)
|
||||||
.Do(e => {
|
.Do(async e => {
|
||||||
if (e.User.Id != NadekoBot.OwnerID || string.IsNullOrWhiteSpace(e.GetArg("text"))) return;
|
if (e.User.Id != NadekoBot.OwnerID || string.IsNullOrWhiteSpace(e.GetArg("text"))) return;
|
||||||
|
|
||||||
Classes.DBHandler.Instance.InsertData(new Classes._DataModels.TypingArticle {
|
Classes.DBHandler.Instance.InsertData(new Classes._DataModels.TypingArticle {
|
||||||
Text = e.GetArg("text"),
|
Text = e.GetArg("text"),
|
||||||
DateAdded = DateTime.Now
|
DateAdded = DateTime.Now
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await e.Send("Added new article for typing.");
|
||||||
});
|
});
|
||||||
|
|
||||||
//todo add user submissions
|
//todo add user submissions
|
||||||
|
@ -224,7 +224,7 @@ namespace NadekoBot.Modules {
|
|||||||
await e.Send($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`");
|
await e.Send($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`");
|
||||||
} catch (Exception) { }
|
} catch (Exception) { }
|
||||||
};
|
};
|
||||||
} catch (Exception ex) {
|
} catch {
|
||||||
await e.Channel.SendMessage(":anger: Failed retrieving osu signature :\\");
|
await e.Channel.SendMessage(":anger: Failed retrieving osu signature :\\");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Parse;
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Modules;
|
using NadekoBot.Modules;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
@ -22,7 +21,6 @@ namespace NadekoBot {
|
|||||||
public static string TrelloAppKey;
|
public static string TrelloAppKey;
|
||||||
public static bool ForwardMessages = false;
|
public static bool ForwardMessages = false;
|
||||||
public static Credentials creds;
|
public static Credentials creds;
|
||||||
public static bool ParseActive = false;
|
|
||||||
|
|
||||||
static void Main() {
|
static void Main() {
|
||||||
//load credentials from credentials.json
|
//load credentials from credentials.json
|
||||||
@ -49,26 +47,11 @@ namespace NadekoBot {
|
|||||||
ForwardMessages = true;
|
ForwardMessages = true;
|
||||||
Console.WriteLine("Forwarding messages.");
|
Console.WriteLine("Forwarding messages.");
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(creds.ParseID) || string.IsNullOrWhiteSpace(creds.ParseKey)) {
|
|
||||||
Console.WriteLine("Parse key and/or ID not found. Some functionality will be missing.");
|
|
||||||
ParseActive = false;
|
|
||||||
} else ParseActive = true;
|
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(creds.OsuApiKey))
|
|
||||||
Console.WriteLine("No osu API key found. Osu functionality is disabled.");
|
|
||||||
else
|
|
||||||
Console.WriteLine("Osu enabled.");
|
|
||||||
if(string.IsNullOrWhiteSpace(creds.SoundCloudClientID))
|
if(string.IsNullOrWhiteSpace(creds.SoundCloudClientID))
|
||||||
Console.WriteLine("No soundcloud Client ID found. Soundcloud streaming is disabled.");
|
Console.WriteLine("No soundcloud Client ID found. Soundcloud streaming is disabled.");
|
||||||
else
|
else
|
||||||
Console.WriteLine("SoundCloud streaming enabled.");
|
Console.WriteLine("SoundCloud streaming enabled.");
|
||||||
|
|
||||||
//init parse
|
|
||||||
if (ParseActive)
|
|
||||||
try {
|
|
||||||
ParseClient.Initialize(creds.ParseID, creds.ParseKey);
|
|
||||||
} catch (Exception) { Console.WriteLine("Parse exception. Probably wrong parse credentials."); }
|
|
||||||
|
|
||||||
OwnerID = creds.OwnerID;
|
OwnerID = creds.OwnerID;
|
||||||
password = creds.Password;
|
password = creds.Password;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -104,14 +104,6 @@
|
|||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Parse, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Parse.1.6.2\lib\net45\Parse.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Parse.NetFx45, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Parse.1.6.2\lib\net45\Parse.NetFx45.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath>
|
<HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
|
Loading…
Reference in New Issue
Block a user