New trivia questions, broke audio.
Improved trivia a bit
This commit is contained in:
parent
fc84c0212e
commit
33e4734d58
@ -5,7 +5,21 @@ VisualStudioVersion = 14.0.24720.0
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot", "NadekoBot\NadekoBot.csproj", "{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NadekoBot", "NadekoBot\NadekoBot.csproj", "{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net", "E:\Ostalo\Discord.Net\src\Discord.Net.Net45\Discord.Net.csproj", "{8D71A857-879A-4A10-859E-5FF824ED6688}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Modules", "E:\Ostalo\Discord.Net\src\Discord.Net.Modules.Net45\Discord.Net.Modules.csproj", "{3091164F-66AE-4543-A63D-167C1116241D}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Commands", "E:\Ostalo\Discord.Net\src\Discord.Net.Commands.Net45\Discord.Net.Commands.csproj", "{1B5603B4-6F8F-4289-B945-7BAAE523D740}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Audio", "E:\Ostalo\Discord.Net\src\Discord.Net.Audio.Net5\Discord.Net.Audio.csproj", "{7BFEF748-B934-4621-9B11-6302E3A9F6B3}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||||
|
E:\Ostalo\Discord.Net\src\Discord.Net.Shared\Discord.Net.Shared.projitems*{7bfef748-b934-4621-9b11-6302e3a9f6b3}*SharedItemsImports = 4
|
||||||
|
E:\Ostalo\Discord.Net\src\Discord.Net.Shared\Discord.Net.Shared.projitems*{1b5603b4-6f8f-4289-b945-7baae523d740}*SharedItemsImports = 4
|
||||||
|
E:\Ostalo\Discord.Net\src\Discord.Net.Shared\Discord.Net.Shared.projitems*{3091164f-66ae-4543-a63d-167c1116241d}*SharedItemsImports = 4
|
||||||
|
E:\Ostalo\Discord.Net\src\Discord.Net.Shared\Discord.Net.Shared.projitems*{8d71a857-879a-4a10-859e-5ff824ed6688}*SharedItemsImports = 4
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
FullDebug|Any CPU = FullDebug|Any CPU
|
FullDebug|Any CPU = FullDebug|Any CPU
|
||||||
@ -18,6 +32,30 @@ Global
|
|||||||
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
|
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.Build.0 = Release|Any CPU
|
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.ActiveCfg = FullDebug|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = FullDebug|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
39
NadekoBot/Classes/SParser.cs
Normal file
39
NadekoBot/Classes/SParser.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NadekoBot.Classes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Shit parser. I used this to convert shit-format to json format
|
||||||
|
/// </summary>
|
||||||
|
class SParser
|
||||||
|
{
|
||||||
|
public static void DoShitParse() {
|
||||||
|
|
||||||
|
string[] lines = File.ReadAllLines("questions.txt");
|
||||||
|
JArray qs = new JArray();
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
if (!line.Contains(";")) continue;
|
||||||
|
JObject j = new JObject();
|
||||||
|
if (line.Contains(":"))
|
||||||
|
{
|
||||||
|
j["Category"] = line.Substring(0, line.LastIndexOf(":"));
|
||||||
|
j["Question"] = line.Substring(line.LastIndexOf(":") + 1, line.LastIndexOf(";") - line.LastIndexOf(":") - 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
j["Question"] = line.Substring(0, line.LastIndexOf(";"));
|
||||||
|
}
|
||||||
|
j["Answer"] = line.Substring(line.LastIndexOf(";") + 1, line.Length - line.LastIndexOf(";") - 1).Trim();
|
||||||
|
qs.Add(j);
|
||||||
|
}
|
||||||
|
File.WriteAllText("questions2.txt", qs.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ using Discord.Commands;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -37,10 +38,11 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
return async e =>
|
return async e =>
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("doign the func");
|
||||||
TriviaGame tg;
|
TriviaGame tg;
|
||||||
if ((tg = StartNewGame(e))!=null)
|
if ((tg = StartNewGame(e))!=null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "**Trivia game started!** It is bound to this channel. But only 1 game can run per server. \n First player to get to 10 points wins! You have 30 seconds per question.\nUse command [tq] if game was started by accident.");
|
await client.SendMessage(e.Channel, "**Trivia game started!**\nFirst player to get to 10 points wins! You have 30 seconds per question.\nUse command [tq] if game was started by accident.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "Trivia game is already running on this server. The question is:\n**"+GetCurrentQuestion(e.Server.Id).Question+"**\n[tq quits trivia]\n[@NadekoBot clr clears my messages]");
|
await client.SendMessage(e.Channel, "Trivia game is already running on this server. The question is:\n**"+GetCurrentQuestion(e.Server.Id).Question+"**\n[tq quits trivia]\n[@NadekoBot clr clears my messages]");
|
||||||
@ -171,10 +173,10 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
users[e.User.Id]++;
|
users[e.User.Id]++;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " Guessed it!\n The answer was: **" + currentQuestion.Answer + "**");
|
await client.SendMessage(e.Channel, e.User.Mention + " Guessed it!\n The answer was: **" + currentQuestion.Answer + "**");
|
||||||
|
|
||||||
if (users[e.User.Id] >= 10) {
|
if (users[e.User.Id] >= 10) {
|
||||||
await client.SendMessage(e.Channel, " We have a winner! It's " + Mention.User(e.User)+"\n"+GetLeaderboard()+"\n To start a new game type '@NadekoBot t'");
|
await client.SendMessage(e.Channel, " We have a winner! It's " + e.User.Mention+"\n"+GetLeaderboard()+"\n To start a new game type '@NadekoBot t'");
|
||||||
FinishGame();
|
FinishGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -209,7 +211,7 @@ namespace NadekoBot
|
|||||||
t.Enabled = true;
|
t.Enabled = true;
|
||||||
t.Elapsed += async (s, ev) => {
|
t.Elapsed += async (s, ev) => {
|
||||||
active = true;
|
active = true;
|
||||||
await client.SendMessage(ch, "QUESTION\n**" + currentQuestion.Question + " **");
|
await client.SendMessage(ch, currentQuestion.ToString());
|
||||||
t.Enabled = false;
|
t.Enabled = false;
|
||||||
timeout.Enabled = true;//starting countdown of the next question
|
timeout.Enabled = true;//starting countdown of the next question
|
||||||
};
|
};
|
||||||
@ -217,7 +219,7 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async void TimeUp() {
|
private async void TimeUp() {
|
||||||
await client.SendMessage(client.GetChannel(_channellId), "**Time's up.**\nCorrect answer was: **" + currentQuestion.Answer+"**\n**[tq quits trivia][tl shows leaderboard][@NadekoBot clr clears my messages]**");
|
await client.SendMessage(client.GetChannel(_channellId), "**Time's up.**\nCorrect answer was: **" + currentQuestion.Answer+"**\n\n*[tq quits trivia][tl shows leaderboard]["+NadekoBot.botMention+" clr clears my messages]*");
|
||||||
LoadNextRound();
|
LoadNextRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +252,7 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class TriviaQuestion {
|
public class TriviaQuestion {
|
||||||
|
public string Category;
|
||||||
public string Question;
|
public string Question;
|
||||||
public string Answer;
|
public string Answer;
|
||||||
public TriviaQuestion(string q, string a) {
|
public TriviaQuestion(string q, string a) {
|
||||||
@ -259,7 +262,7 @@ namespace NadekoBot
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return this.Question;
|
return this.Category == null ? "--------**Q**--------\nQuestion: **" + this.Question + "?**" : "--------Q--------\nCategory: " + this.Category + "\nQuestion: **"+ this.Question+ "?**";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,16 +286,18 @@ namespace NadekoBot
|
|||||||
public TriviaQuestionsPool() {
|
public TriviaQuestionsPool() {
|
||||||
_r = new Random();
|
_r = new Random();
|
||||||
pool = new List<TriviaQuestion>();
|
pool = new List<TriviaQuestion>();
|
||||||
var httpClient = new System.Net.Http.HttpClient();
|
JArray arr = JArray.Parse(File.ReadAllText("questions.txt"));
|
||||||
|
|
||||||
|
foreach (var item in arr)
|
||||||
var r = httpClient.GetAsync("http://jservice.io/api/clues?category=19").Result;
|
|
||||||
string str = r.Content.ReadAsStringAsync().Result;
|
|
||||||
dynamic obj = JArray.Parse(str);
|
|
||||||
|
|
||||||
foreach (var item in obj)
|
|
||||||
{
|
{
|
||||||
pool.Add(new TriviaQuestion((string)item.question,(string)item.answer));
|
TriviaQuestion tq;
|
||||||
|
tq = new TriviaQuestion((string)item["Question"],(string)item["Answer"]);
|
||||||
|
|
||||||
|
if (item?["Category"] != null) {
|
||||||
|
tq.Category = item["Category"].ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
pool.Add(tq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ namespace NadekoBot.Modules
|
|||||||
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
||||||
string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
||||||
|
|
||||||
await client.SendMessage(e.Channel, String.Format("```Servers: {0}\nUnique Users: {1}\nUptime: {2}\nMy id is: {3}```", serverCount, uniqueUserCount, uptime, client.CurrentUserId));
|
await client.SendMessage(e.Channel, String.Format("```Servers: {0}\nUnique Users: {1}\nUptime: {2}\nMy id is: {3}```", serverCount, uniqueUserCount, uptime, client.CurrentUser.Id));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,14 +45,14 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Nadeko replies with /o/")
|
.Description("Nadeko replies with /o/")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + "/o/");
|
await client.SendMessage(e.Channel, e.User.Mention + "/o/");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("/o/")
|
cgb.CreateCommand("/o/")
|
||||||
.Description("Nadeko replies with \\o\\")
|
.Description("Nadeko replies with \\o\\")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + "\\o\\");
|
await client.SendMessage(e.Channel, e.User.Mention + "\\o\\");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ namespace NadekoBot.Modules
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (e.User.Id == NadekoBot.OwnerID)
|
if (e.User.Id == NadekoBot.OwnerID)
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + ", Of course I do, my Master.");
|
await client.SendMessage(e.Channel, e.User.Mention + ", Of course I do, my Master.");
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + ", Don't be silly.");
|
await client.SendMessage(e.Channel, e.User.Mention + ", Don't be silly.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "die")
|
CreateCommand(cgb, "die")
|
||||||
@ -82,10 +82,10 @@ namespace NadekoBot.Modules
|
|||||||
t.Interval = 2000;
|
t.Interval = 2000;
|
||||||
t.Elapsed += (s, ev) => { Environment.Exit(0); };
|
t.Elapsed += (s, ev) => { Environment.Exit(0); };
|
||||||
t.Start();
|
t.Start();
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + ", Yes, my love.");
|
await client.SendMessage(e.Channel, e.User.Mention + ", Yes, my love.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + ", No.");
|
await client.SendMessage(e.Channel, e.User.Mention + ", No.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "how are you")
|
CreateCommand(cgb, "how are you")
|
||||||
@ -94,18 +94,18 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (e.User.Id == NadekoBot.OwnerID)
|
if (e.User.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " I am great as long as you are here.");
|
await client.SendMessage(e.Channel, e.User.Mention + " I am great as long as you are here.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var kw = client.GetUser(e.Server, NadekoBot.OwnerID);
|
var kw = client.GetUser(e.Server, NadekoBot.OwnerID);
|
||||||
if (kw != null && kw.Status == UserStatus.Online)
|
if (kw != null && kw.Status == UserStatus.Online)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " I am great as long as " + Mention.User(kw) + " is with me.");
|
await client.SendMessage(e.Channel, e.User.Mention + " I am great as long as " + Mention.User(kw) + " is with me.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " I am sad. My Master is not with me.");
|
await client.SendMessage(e.Channel, e.User.Mention + " I am sad. My Master is not with me.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -128,7 +128,7 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " Eww, why would i do that for you ?!");
|
await client.SendMessage(e.Channel, e.User.Mention + " Eww, why would i do that for you ?!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -153,11 +153,11 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (u.Id == NadekoBot.OwnerID)
|
if (u.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " I don't need your permission to praise my beloved Master <3");
|
await client.SendMessage(e.Channel, e.User.Mention + " I don't need your permission to praise my beloved Master <3");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " Yeah... No.");
|
await client.SendMessage(e.Channel, e.User.Mention + " Yeah... No.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -166,7 +166,7 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Useless.")
|
.Description("Useless.")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " I will be soon.");
|
await client.SendMessage(e.Channel, e.User.Mention + " I will be soon.");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("are you there")
|
cgb.CreateCommand("are you there")
|
||||||
@ -398,7 +398,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (StatsCollector.DeleteRequest(int.Parse(e.Args[0])))
|
if (StatsCollector.DeleteRequest(int.Parse(e.Args[0])))
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " Request deleted.");
|
await client.SendMessage(e.Channel, e.User.Mention + " Request deleted.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -425,7 +425,7 @@ namespace NadekoBot.Modules
|
|||||||
var sc = StatsCollector.ResolveRequest(int.Parse(e.Args[0]));
|
var sc = StatsCollector.ResolveRequest(int.Parse(e.Args[0]));
|
||||||
if (sc != null)
|
if (sc != null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(e.User) + " Request resolved, notice sent.");
|
await client.SendMessage(e.Channel, e.User.Mention + " Request resolved, notice sent.");
|
||||||
await client.SendPrivateMessage(client.GetUser(client.GetServer(sc.ServerId), sc.Id), "**This request of yours has been resolved:**\n" + sc.Text);
|
await client.SendPrivateMessage(client.GetUser(client.GetServer(sc.ServerId), sc.Id), "**This request of yours has been resolved:**\n" + sc.Text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -20,7 +20,7 @@ namespace NadekoBot.Modules
|
|||||||
private static bool exit = true;
|
private static bool exit = true;
|
||||||
|
|
||||||
public static bool NextSong = false;
|
public static bool NextSong = false;
|
||||||
public static IDiscordVoiceClient Voice;
|
public static Discord.Audio.DiscordAudioClient Voice;
|
||||||
public static Channel VoiceChannel;
|
public static Channel VoiceChannel;
|
||||||
public static bool Pause = false;
|
public static bool Pause = false;
|
||||||
public static List<YouTubeVideo> SongQueue = new List<YouTubeVideo>();
|
public static List<YouTubeVideo> SongQueue = new List<YouTubeVideo>();
|
||||||
@ -144,7 +144,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (Voice != null) return;
|
if (Voice != null) return;
|
||||||
VoiceChannel = client.FindChannels(e.Server, e.GetArg("ChannelName").Trim(), ChannelType.Voice).FirstOrDefault();
|
VoiceChannel = client.FindChannels(e.Server, e.GetArg("ChannelName").Trim(), ChannelType.Voice).FirstOrDefault();
|
||||||
Voice = await client.JoinVoiceServer(VoiceChannel);
|
//Voice = await client.JoinVoiceServer(VoiceChannel);
|
||||||
Exit = false;
|
Exit = false;
|
||||||
NextSong = false;
|
NextSong = false;
|
||||||
Pause = false;
|
Pause = false;
|
||||||
@ -176,7 +176,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
while ((byteCount = stream.Read(buffer, 0, blockSize)) > 0)
|
while ((byteCount = stream.Read(buffer, 0, blockSize)) > 0)
|
||||||
{
|
{
|
||||||
Voice.SendVoicePCM(buffer, byteCount);
|
// Voice.SendVoicePCM(buffer, byteCount);
|
||||||
counter += blockSize;
|
counter += blockSize;
|
||||||
if (NextSong)
|
if (NextSong)
|
||||||
{
|
{
|
||||||
@ -193,10 +193,10 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await Voice.WaitVoice();
|
// await Voice.WaitVoice();
|
||||||
}
|
}
|
||||||
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
|
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
|
||||||
await client.LeaveVoiceServer(VoiceChannel.Server);
|
// await client.LeaveVoiceServer(VoiceChannel.Server);
|
||||||
Voice = null;
|
Voice = null;
|
||||||
VoiceChannel = null;
|
VoiceChannel = null;
|
||||||
});
|
});
|
||||||
|
@ -2,26 +2,26 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.Modules;
|
|
||||||
using Parse;
|
using Parse;
|
||||||
|
using Discord.Commands;
|
||||||
using NadekoBot.Modules;
|
using NadekoBot.Modules;
|
||||||
|
using Discord.Modules;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
class NadekoBot
|
class NadekoBot
|
||||||
{
|
{
|
||||||
public static DiscordClient client;
|
public static DiscordClient client;
|
||||||
public static StatsCollector sc;
|
// public static StatsCollector stats_collector;
|
||||||
public static string botMention;
|
public static string botMention;
|
||||||
public static string GoogleAPIKey;
|
public static string GoogleAPIKey;
|
||||||
public static long OwnerID;
|
public static long OwnerID;
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main()
|
||||||
{
|
{
|
||||||
//load credentials from credentials.json
|
//load credentials from credentials.json
|
||||||
Credentials c;
|
Credentials c;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
c = JsonConvert.DeserializeObject<Credentials>(File.ReadAllText("credentials.json"));
|
c = JsonConvert.DeserializeObject<Credentials>(File.ReadAllText("credentials.json"));
|
||||||
@ -36,14 +36,14 @@ namespace NadekoBot
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client = new DiscordClient();
|
||||||
|
|
||||||
//init parse
|
//init parse
|
||||||
if (c.ParseKey != null && c.ParseID != null)
|
if (c.ParseKey != null && c.ParseID != null)
|
||||||
ParseClient.Initialize(c.ParseID,c.ParseKey);
|
ParseClient.Initialize(c.ParseID,c.ParseKey);
|
||||||
|
|
||||||
//create new discord client
|
//create new discord client
|
||||||
client = new DiscordClient(new DiscordClientConfig() {
|
|
||||||
VoiceMode = DiscordVoiceMode.Outgoing,
|
|
||||||
});
|
|
||||||
|
|
||||||
//create a command service
|
//create a command service
|
||||||
var commandService = new CommandService(new CommandServiceConfig
|
var commandService = new CommandService(new CommandServiceConfig
|
||||||
@ -53,7 +53,7 @@ namespace NadekoBot
|
|||||||
});
|
});
|
||||||
|
|
||||||
//monitor commands for logging
|
//monitor commands for logging
|
||||||
sc = new StatsCollector(commandService);
|
//stats_collector = new StatsCollector(commandService);
|
||||||
|
|
||||||
//add command service
|
//add command service
|
||||||
var commands = client.AddService(commandService);
|
var commands = client.AddService(commandService);
|
||||||
@ -66,45 +66,17 @@ namespace NadekoBot
|
|||||||
modules.Install(new Conversations(), "Conversations", FilterType.Unrestricted);
|
modules.Install(new Conversations(), "Conversations", FilterType.Unrestricted);
|
||||||
modules.Install(new Gambling(), "Gambling", FilterType.Unrestricted);
|
modules.Install(new Gambling(), "Gambling", FilterType.Unrestricted);
|
||||||
modules.Install(new Games(), "Games", FilterType.Unrestricted);
|
modules.Install(new Games(), "Games", FilterType.Unrestricted);
|
||||||
modules.Install(new Music(), "Music", FilterType.Unrestricted);
|
//modules.Install(new Music(), "Music", FilterType.Unrestricted);
|
||||||
modules.Install(new Searches(), "Searches", FilterType.Unrestricted);
|
modules.Install(new Searches(), "Searches", FilterType.Unrestricted);
|
||||||
|
|
||||||
commands.CommandError += Commands_CommandError;
|
|
||||||
|
|
||||||
//run the bot
|
//run the bot
|
||||||
client.Run(async () =>
|
client.Run(async () =>
|
||||||
{
|
{
|
||||||
Console.WriteLine("Trying to connect...");
|
await client.Connect(c.Username, c.Password);
|
||||||
try
|
Console.WriteLine("Connected!");
|
||||||
{
|
|
||||||
await client.Connect(c.Username, c.Password);
|
|
||||||
Console.WriteLine("Connected!");
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Console.WriteLine("Exiting...");
|
Console.WriteLine("Exiting...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Commands_CommandError(object sender, CommandErrorEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Command != null)
|
|
||||||
client.SendMessage(e.Channel, Mention.User(e.User) + " Command failed. See help (-h).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async void TryJoin(string code)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await NadekoBot.client.AcceptInvite(await NadekoBot.client.GetInvite(code));
|
|
||||||
File.AppendAllText("invites.txt", code + "\n");
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
StatsCollector.DEBUG_LOG("Failed to join " + code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,21 @@
|
|||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -36,6 +51,9 @@
|
|||||||
<Reference Include="Discord.Net">
|
<Reference Include="Discord.Net">
|
||||||
<HintPath>E:\Ostalo\Discord.Net\src\Discord.Net.Modules.Net45\bin\Debug\Discord.Net.dll</HintPath>
|
<HintPath>E:\Ostalo\Discord.Net\src\Discord.Net.Modules.Net45\bin\Debug\Discord.Net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Discord.Net.Audio">
|
||||||
|
<HintPath>E:\Ostalo\Discord.Net\src\Discord.Net.Audio.Net5\bin\Debug\Discord.Net.Audio.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Discord.Net.Commands">
|
<Reference Include="Discord.Net.Commands">
|
||||||
<HintPath>E:\Ostalo\Discord.Net\src\Discord.Net.Modules.Net45\bin\Debug\Discord.Net.Commands.dll</HintPath>
|
<HintPath>E:\Ostalo\Discord.Net\src\Discord.Net.Modules.Net45\bin\Debug\Discord.Net.Commands.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -81,6 +99,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Classes\SParser.cs" />
|
||||||
<Compile Include="Classes\_JSONModels.cs" />
|
<Compile Include="Classes\_JSONModels.cs" />
|
||||||
<Compile Include="Classes\Cards.cs" />
|
<Compile Include="Classes\Cards.cs" />
|
||||||
<Compile Include="Classes\Extensions.cs" />
|
<Compile Include="Classes\Extensions.cs" />
|
||||||
@ -107,7 +126,18 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
@ -26,7 +26,7 @@ namespace NadekoBot
|
|||||||
this._service = service;
|
this._service = service;
|
||||||
|
|
||||||
_service.RanCommand += StatsCollector_RanCommand;
|
_service.RanCommand += StatsCollector_RanCommand;
|
||||||
NadekoBot.client.MessageReceived += Client_MessageReceived;
|
//NadekoBot.client.MessageReceived += Client_MessageReceived;
|
||||||
|
|
||||||
StartCollecting();
|
StartCollecting();
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ namespace NadekoBot
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await NadekoBot.client.AcceptInvite(await NadekoBot.client.GetInvite(code));
|
await NadekoBot.client.AcceptInvite(await NadekoBot.client.GetInvite(code));
|
||||||
await NadekoBot.client.SendMessage(e.Channel, Mention.User(e.User) + " I joined it, thanks :)");
|
await NadekoBot.client.SendMessage(e.Channel, e.User.Mention + " I joined it, thanks :)");
|
||||||
DEBUG_LOG("Sucessfuly joined server with code " + code);
|
DEBUG_LOG("Sucessfuly joined server with code " + code);
|
||||||
DEBUG_LOG("Here is a link for you: discord.gg/" + code);
|
DEBUG_LOG("Here is a link for you: discord.gg/" + code);
|
||||||
}
|
}
|
||||||
@ -172,6 +172,7 @@ namespace NadekoBot
|
|||||||
|
|
||||||
private void StatsCollector_RanCommand(object sender, CommandEventArgs e)
|
private void StatsCollector_RanCommand(object sender, CommandEventArgs e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("command ran");
|
||||||
commandsRan++;
|
commandsRan++;
|
||||||
var obj = new ParseObject("CommandsRan");
|
var obj = new ParseObject("CommandsRan");
|
||||||
|
|
||||||
|
BIN
dlls/Discord.Net.Audio.dll
Normal file
BIN
dlls/Discord.Net.Audio.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dlls/libvideo.dll
Normal file
BIN
dlls/libvideo.dll
Normal file
Binary file not shown.
24549
dlls/questions.txt
Normal file
24549
dlls/questions.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user