Removed extra spaces. Removed double \r\n across all code files.

This commit is contained in:
Christopher Darnell committed 2021-05-06 20:07:03 -07:00
1 parent 91d6d1531b
commit 5bb1b43e81
19 files changed
+68 -389

No files matched your search

-14
View File
@@ -7,8 +7,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace StarsiegeBot
{
[Group("notfact")]
@@ -17,19 +15,16 @@ namespace StarsiegeBot
private List<string> _notfacts;
private bool _isEnabled;
private static readonly string s_fileName = "Json/notfacts.json";
public NotFacts()
{
Console.WriteLine("NotFacts Command Loaded");
_isEnabled = Load();
}
[GroupCommand, Description("Get a NotFact")]
public async Task NotFact(CommandContext ctx, [Description("[Optional] A NotFact ID")] int notFactID = 0)
{
if (!_isEnabled)
return;
await ctx.TriggerTypingAsync();
string output;
notFactID--;
try
@@ -42,21 +37,17 @@ namespace StarsiegeBot
}
await ctx.RespondAsync(StartEmbed(output));
}
[Command("count"), Aliases("c"), Description("Get a count of the NotFacts")]
public async Task NotFactCount(CommandContext ctx)
{
if (!_isEnabled)
return;
await ctx.TriggerTypingAsync();
await ctx.RespondAsync(StartEmbed(_notfacts.Count + " NotFacts in the NotFacts Bank"));
}
[Command("load"), RequireOwner, Aliases("l")]
public async Task Load(CommandContext ctx)
{
// trigger the typing.
await ctx.TriggerTypingAsync();
// start the response.
DiscordEmbedBuilder embed = StartEmbed("Reloading NotFacts");
// our old setting...
@@ -71,12 +62,10 @@ namespace StarsiegeBot
// send our results.
await ctx.RespondAsync(embed);
}
[Command("toggle"), RequireOwner, Aliases("t")]
public async Task Enable(CommandContext ctx, [RemainingText] string isEnabled = null)
{
// trigger the typing.
await ctx.TriggerTypingAsync();
// lower case teh input.
isEnabled = isEnabled.ToLower();
string[] turnOn = { "on", "true", "1" };
@@ -114,8 +103,6 @@ namespace StarsiegeBot
}
await ctx.RespondAsync(embed);
}
private DiscordEmbedBuilder StartEmbed(string desc)
{
DiscordEmbedBuilder embed = new DiscordEmbedBuilder
@@ -125,7 +112,6 @@ namespace StarsiegeBot
};
return embed;
}
private bool Load()
{
bool ret;
+1 -14
View File
@@ -7,8 +7,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace StarsiegeBot
{
[Group("snapple"), Aliases("snap")]
@@ -17,13 +15,11 @@ namespace StarsiegeBot
private List<string> _facts;
private bool _isEnabled;
private static readonly string s_fileName = "Json/snapple.json";
public SnappleFacts()
{
Console.WriteLine("Snapple Commands Loaded");
_isEnabled = Load();
}
[GroupCommand, Description("Get a Snapple \"Real Fact\".")]
public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")] int snapId = 0)
{
@@ -31,8 +27,7 @@ namespace StarsiegeBot
if (!_isEnabled)
return;
// trigger typing.
await ctx.TriggerTypingAsync();
// store our output.
// store our output.
string output;
// @neo, why is this here?
snapId--;
@@ -49,22 +44,18 @@ namespace StarsiegeBot
// give them what they want.
await ctx.RespondAsync(StartEmbed(output));
}
[Command("count"), Description("Get a Snapple \"Real Fact\"."), Aliases("c")]
public async Task SnappleCount(CommandContext ctx)
{
if (!_isEnabled)
return;
await ctx.TriggerTypingAsync();
// trigger the typing, and report how many facts are in teh bank.
await ctx.RespondAsync(StartEmbed(_facts.Count + " facts in the Snapple \"Real Facts\" Bank"));
}
[Command("load"), RequireOwner, Aliases("l")]
public async Task Load(CommandContext ctx)
{
// trigger the typing.
await ctx.TriggerTypingAsync();
// start the response.
DiscordEmbedBuilder embed = StartEmbed("Reloading Snapple Facts");
// our old setting...
@@ -79,12 +70,10 @@ namespace StarsiegeBot
// send our results.
await ctx.RespondAsync(embed);
}
[Command("toggle"), RequireOwner, Aliases("t")]
public async Task Enable(CommandContext ctx, [RemainingText] string isEnabled = null)
{
// trigger the typing.
await ctx.TriggerTypingAsync();
// lower case teh input.
isEnabled = isEnabled.ToLower();
string[] turnOn = { "on", "true", "1" };
@@ -122,7 +111,6 @@ namespace StarsiegeBot
}
await ctx.RespondAsync(embed);
}
private DiscordEmbedBuilder StartEmbed(string desc)
{
DiscordEmbedBuilder embed = new DiscordEmbedBuilder
@@ -132,7 +120,6 @@ namespace StarsiegeBot
};
return embed;
}
private bool Load()
{
bool ret;
-14
View File
@@ -10,7 +10,6 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot.Raven
{
class TriviaHandler : BaseCommandModule
@@ -26,33 +25,25 @@ namespace StarsiegeBot.Raven
json = sr.ReadToEnd();
Dictionary<string, Questions> tempQC = JsonConvert.DeserializeObject<Dictionary<string, Questions>>(json);
_quizQuestions = Enumerable.ToList(tempQC.Values);
}
[Command("quiz")]
[Hidden]
[Description("")]
public async Task Quiz(CommandContext ctx)
{
await ctx.TriggerTypingAsync();
DiscordEmbedBuilder embed = new DiscordEmbedBuilder();
int[] ids = { Program.rnd.Next(_quizQuestions.Count), Program.rnd.Next(_quizQuestions.Count), Program.rnd.Next(_quizQuestions.Count), Program.rnd.Next(_quizQuestions.Count) };
int selection = Program.rnd.Next(ids.Length);
int mainId = ids[selection];
string[] options = { "a", "b", "c", "d" };
var correctAnswer = DiscordEmoji.FromName(ctx.Client, $":regional_indicator_{options[selection]}:");
Questions myQuestion = _quizQuestions[mainId];
embed.Description = myQuestion.Question;
embed.AddField($":regional_indicator_{options[0]}:", _quizQuestions[ids[0]].Answers[Program.rnd.Next(_quizQuestions[ids[0]].Answers.Length)], true);
embed.AddField($":regional_indicator_{options[1]}:", _quizQuestions[ids[1]].Answers[Program.rnd.Next(_quizQuestions[ids[1]].Answers.Length)], true);
embed.AddField("_ _", "_ _", false);
embed.AddField($":regional_indicator_{options[2]}:", _quizQuestions[ids[2]].Answers[Program.rnd.Next(_quizQuestions[ids[2]].Answers.Length)], true);
embed.AddField($":regional_indicator_{options[3]}:", _quizQuestions[ids[3]].Answers[Program.rnd.Next(_quizQuestions[ids[3]].Answers.Length)], true);
DiscordMessage message = await ctx.RespondAsync(embed);
foreach (string item in options)
{
@@ -67,14 +58,12 @@ namespace StarsiegeBot.Raven
}
else await ctx.RespondAsync("Sorry, time ran out!");
}
[Command("test")]
[Hidden]
public async Task CollectionCommand(CommandContext ctx)
{
DiscordMessage message = await ctx.RespondAsync("React here!");
var reactions = await message.CollectReactionsAsync();
var strBuilder = new StringBuilder();
Dictionary<DiscordUser, bool> winners = new Dictionary<DiscordUser, bool>();
Dictionary<DiscordUser, bool> losers = new Dictionary<DiscordUser, bool>();
@@ -100,17 +89,14 @@ namespace StarsiegeBot.Raven
winners.Remove(pair.Key);
}
}
strBuilder.AppendLine("Winners are:");
foreach (KeyValuePair<DiscordUser, bool> item in winners)
{
strBuilder.AppendLine(item.Key.Mention);
}
await ctx.RespondAsync(strBuilder.ToString());
}
}
public class Questions
{
[JsonProperty("question")]