Suppression Challonge in Db.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -19,7 +20,6 @@ namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
dep = d;
|
||||
rnd = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
}
|
||||
|
||||
[Command("twitch")]
|
||||
@@ -28,8 +28,29 @@ namespace LaDOSE.DiscordBot.Command
|
||||
await ctx.RespondAsync("https://www.twitch.tv/LaDOSETV");
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Command("roll")]
|
||||
public async Task RollAsync(CommandContext ctx, string command = "")
|
||||
{
|
||||
int next = 6;
|
||||
|
||||
if (!string.IsNullOrEmpty(command))
|
||||
{
|
||||
if(!int.TryParse(command, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture, out next))
|
||||
{
|
||||
await ctx.RespondAsync("Stupid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
await ctx.RespondAsync(rnd.Next(1,next+1).ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region Cards Against Humanity
|
||||
[Command("cards")]
|
||||
public async Task CardssAsync(CommandContext ctx)
|
||||
public async Task CardsAsync(CommandContext ctx)
|
||||
{
|
||||
if (Questions == null)
|
||||
LoadCards();
|
||||
@@ -38,19 +59,13 @@ namespace LaDOSE.DiscordBot.Command
|
||||
var q = Questions[rnd.Next(Questions.Count - 1)];
|
||||
|
||||
var s = q.Split('_', StringSplitOptions.RemoveEmptyEntries);
|
||||
for(int i = 0; i< s.Length; i++)
|
||||
for (int i = 0; i < s.Length - 1; i++)
|
||||
{
|
||||
if (i < s.Length-1)
|
||||
{
|
||||
response += s[i] + Answers[rnd.Next(Answers.Count - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
response += s[i];
|
||||
}
|
||||
|
||||
response += s[i] + Answers[rnd.Next(Answers.Count - 1)];
|
||||
}
|
||||
|
||||
response += s[s.Length-1];
|
||||
|
||||
|
||||
|
||||
await ctx.RespondAsync(response);
|
||||
}
|
||||
@@ -67,26 +82,29 @@ namespace LaDOSE.DiscordBot.Command
|
||||
Questions = new List<string>();
|
||||
Answers = new List<string>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Quotes
|
||||
[Command("Quote")]
|
||||
public async Task QuotesAsync(CommandContext ctx)
|
||||
{
|
||||
if (Quotes == null)
|
||||
LoadQuote();
|
||||
|
||||
await ctx.RespondAsync("```"+ Quotes[rnd.Next(Quotes.Count-1)] + "```");
|
||||
await ctx.RespondAsync("```" + Quotes[rnd.Next(Quotes.Count - 1)] + "```");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LoadQuote()
|
||||
{
|
||||
Quotes = new List<string>();
|
||||
string[] fileQuotes = File.ReadAllLines("quotes.txt");
|
||||
string currentQuote = string.Empty;
|
||||
for(int i = 0; i < fileQuotes.Length; i++)
|
||||
for (int i = 0; i < fileQuotes.Length; i++)
|
||||
{
|
||||
if(String.IsNullOrEmpty(fileQuotes[i]))
|
||||
if (String.IsNullOrEmpty(fileQuotes[i]))
|
||||
{
|
||||
Quotes.Add(currentQuote);
|
||||
currentQuote = string.Empty;
|
||||
@@ -94,7 +112,8 @@ namespace LaDOSE.DiscordBot.Command
|
||||
|
||||
currentQuote += fileQuotes[i] + (!String.IsNullOrEmpty(currentQuote) ? "\r\n" : "");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user