fixed typestop, typeadd added, saving data in parse.
This commit is contained in:
parent
796fa10625
commit
ca536db646
@ -10,11 +10,12 @@ using System.Threading;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Parse;
|
using Parse;
|
||||||
|
|
||||||
namespace NadekoBot {
|
namespace NadekoBot {
|
||||||
|
|
||||||
public static class SentencesProvider {
|
public static class SentencesProvider {
|
||||||
internal static string GetRandomSentence() {
|
internal static string GetRandomSentence() {
|
||||||
return "Random ultra long test sentence that i have to type every time.";
|
var data = new ParseQuery<ParseObject>("TypingArticles").FindAsync().Result;
|
||||||
|
return data.ToList()[(new Random()).Next(0, data.Count())].Get<string>("text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +61,9 @@ namespace NadekoBot {
|
|||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
i--;
|
i--;
|
||||||
if (!IsActive)
|
if (!IsActive)
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Stop();
|
await Stop();
|
||||||
await Start();
|
await Start();
|
||||||
}
|
}
|
||||||
@ -124,6 +125,19 @@ namespace NadekoBot {
|
|||||||
cgb.CreateCommand("typestop")
|
cgb.CreateCommand("typestop")
|
||||||
.Description("Stops a typing contest on the current channel.")
|
.Description("Stops a typing contest on the current channel.")
|
||||||
.Do(QuitFunc());
|
.Do(QuitFunc());
|
||||||
|
|
||||||
|
cgb.CreateCommand("typeadd")
|
||||||
|
.Description("Adds a new article to the typing contest. Owner only.")
|
||||||
|
.Parameter("text",ParameterType.Unparsed)
|
||||||
|
.Do(async e => {
|
||||||
|
if (e.User.Id != NadekoBot.OwnerID || e.GetArg("text") == null) return;
|
||||||
|
|
||||||
|
var obj = new ParseObject("TypingArticles");
|
||||||
|
obj["text"] = e.GetArg("text");
|
||||||
|
await obj.SaveAsync();
|
||||||
|
await e.Send("Added new typing article.");
|
||||||
|
});
|
||||||
|
//todo add user submissions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,6 @@ namespace NadekoBot
|
|||||||
public static void DEBUG_LOG(string text) {
|
public static void DEBUG_LOG(string text) {
|
||||||
#pragma warning disable CS4014
|
#pragma warning disable CS4014
|
||||||
//NadekoBot.client.GetChannel(119365591852122112).Send(text);
|
//NadekoBot.client.GetChannel(119365591852122112).Send(text);
|
||||||
//TODO YOU MIGHT WANT TO CHANGE THIS TO LOOK LIKE THE LINE ABOVE
|
|
||||||
Console.WriteLine(text);
|
Console.WriteLine(text);
|
||||||
#pragma warning restore CS4014
|
#pragma warning restore CS4014
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user