Told VS to do a Code Cleanup.

This commit is contained in:
Chris Darnell committed 2021-04-30 18:31:30 -07:00
1 parent 50c5bd0caa
commit bf94bffb77
18 files changed
+138 -282

No files matched your search

+11 -17
View File
@@ -1,21 +1,15 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot
{
@@ -117,7 +111,7 @@ namespace StarsiegeBot
}
[GroupCommand]
public async Task DeathMessage(CommandContext ctx, [Description("Optional. Person you want to see kill you. If blank, will show generic death message.")]DiscordMember target = null)
public async Task DeathMessage(CommandContext ctx, [Description("Optional. Person you want to see kill you. If blank, will show generic death message.")] DiscordMember target = null)
{
// We're typing! (In all honesty, this is just used to avoid the 'async task not using await' messages I get.
await ctx.TriggerTypingAsync();
@@ -129,7 +123,7 @@ namespace StarsiegeBot
await ctx.RespondAsync("Death Messages Commands have been disabled. Please contact the bot owners.");
return;
}
// set some basic output incase something goes south.
string line = "Something went wrong.";
// if there is no target, we're going to "kill" the author.
@@ -182,7 +176,7 @@ namespace StarsiegeBot
[Command("Add")]
[Description("Adds a message to the Pending Death Message Queue. Generic Death Messages require just a [Killed] while any other death message requires both a [Killed] and a [Killer] tags. These will be replaced with the correct information in game, and in the usage of random DM generation.")]
[Cooldown(1, 2, CooldownBucketType.Guild)]
public async Task DeathMessageNew(CommandContext ctx, [RemainingText,Description("The Death Message you want added. See help section.")] string msg)
public async Task DeathMessageNew(CommandContext ctx, [RemainingText, Description("The Death Message you want added. See help section.")] string msg)
{
// IF we're missing the Death Messages dot JSON file, we're going to get disabled... Check for that.
// If disabled, let the person know the command set is disabled, and return.
@@ -265,7 +259,7 @@ namespace StarsiegeBot
// Tell DSharp that we want to upload this file.
msg.WithFile("deathmessages.cs", sound);
// Add some content so its not a blank file.
msg.Content ="Here is your request for a death message script.";
msg.Content = "Here is your request for a death message script.";
// send that message.
await ctx.RespondAsync(msg);
// We're done with the file, so close access to it.
+7 -13
View File
@@ -1,21 +1,15 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot
{
+12 -22
View File
@@ -1,22 +1,12 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot
{
@@ -50,7 +40,7 @@ namespace StarsiegeBot
}
}
[GroupCommand]
public async Task Overview (CommandContext ctx)
public async Task Overview(CommandContext ctx)
{
await ctx.TriggerTypingAsync();
Update();
@@ -70,9 +60,9 @@ namespace StarsiegeBot
Title = "Master|Game Server Overview",
Description = "Number of Master, and Game servers. Along with number of errors."
};
embed.AddField("Masters", gameData.Masters.Length.ToString(),true);
embed.AddField("Games", gameData.Games.Length.ToString(),true);
embed.AddField("Errors", gameData.Errors.Length.ToString(),true);
embed.AddField("Masters", gameData.Masters.Length.ToString(), true);
embed.AddField("Games", gameData.Games.Length.ToString(), true);
embed.AddField("Errors", gameData.Errors.Length.ToString(), true);
await ctx.RespondAsync(embed);
}
@@ -106,7 +96,7 @@ namespace StarsiegeBot
[Command("Masters"), Aliases("m")]
[Description("Gives all the master servers as a script to be improted into `master.cs`.")]
public async Task MasterServers (CommandContext ctx)
public async Task MasterServers(CommandContext ctx)
{
await ctx.TriggerTypingAsync();
Update();
@@ -137,7 +127,7 @@ namespace StarsiegeBot
[Command("games"), Aliases("g")]
[Description("Currently: Lists games that have been started (Player dropped in). End Result: Lists all games that have a player in the server (either dropped in or not)")]
public async Task GameServers(CommandContext ctx, [Description("Number of players you want to check for. Game servers will need at least this meaning or more to be listed.")]int playerCount = 1)
public async Task GameServers(CommandContext ctx, [Description("Number of players you want to check for. Game servers will need at least this meaning or more to be listed.")] int playerCount = 1)
{
await ctx.TriggerTypingAsync();
Update();
@@ -145,7 +135,7 @@ namespace StarsiegeBot
// setup an exit point check.
bool exit = false;
// if its null, we're going to exit.
if(gameData is null || gameData.Games is null)
if (gameData is null || gameData.Games is null)
{
exit = true;
}
+14 -20
View File
@@ -1,21 +1,15 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot
{
@@ -44,7 +38,7 @@ namespace StarsiegeBot
var json = "";
using (var fs = File.OpenRead("quickchats.json"))
using (var sr = new StreamReader(fs, new UTF8Encoding(false)))
json = sr.ReadToEnd();
json = sr.ReadToEnd();
quickchats = JsonConvert.DeserializeObject<Dictionary<string, Quickchat>>(json);
// enable the commands.
return true;
@@ -194,7 +188,7 @@ namespace StarsiegeBot
{
// Open the file.
FileStream sound = new FileStream($"./qc/{chat.soundFile}", FileMode.Open, FileAccess.Read);
// feed it to the Message Builder.
msg.WithFile(chat.soundFile, sound);
}
@@ -205,9 +199,9 @@ namespace StarsiegeBot
}
[Command("search"), Aliases("s")]
[Cooldown(1,5,CooldownBucketType.Global)]
[Cooldown(1, 5, CooldownBucketType.Global)]
[Description("Searches all the [T]ext and [S]ound file names for the Search input.")]
public async Task SearchQuickChats(CommandContext ctx, [RemainingText,Description("What to search for.")] string toSearch)
public async Task SearchQuickChats(CommandContext ctx, [RemainingText, Description("What to search for.")] string toSearch)
{
await ctx.TriggerTypingAsync();
string output;
@@ -223,7 +217,7 @@ namespace StarsiegeBot
StringBuilder sb = new StringBuilder();
DiscordMessageBuilder msg = new DiscordMessageBuilder();
int count = 0;
// We're going to search each QC for the stuff in toSearch.
foreach (KeyValuePair<string, Quickchat> qc in quickchats)
{
@@ -262,7 +256,7 @@ namespace StarsiegeBot
[Command("toggle"), Aliases("t")]
[RequireOwner]
[Description("[Owner only] Enables or disables, or checks status of QuickChats.\r\nTo turn the feature on, use `TRUE`, `ON`, or `1`\r\nTo turn off, use `FALSE`, `OFF`, or `0`")]
public async Task ToggleQC (CommandContext ctx, [RemainingText] string isEnabled = null)
public async Task ToggleQC(CommandContext ctx, [RemainingText] string isEnabled = null)
{
await ctx.TriggerTypingAsync();
isEnabled = isEnabled.ToLower();
@@ -281,7 +275,7 @@ namespace StarsiegeBot
IsEnabled = false;
}
output = $"Quickchats {(IsEnabled ? "Enabled":"Disabled")}";
output = $"Quickchats {(IsEnabled ? "Enabled" : "Disabled")}";
}
else
{