diff --git a/StarsiegeBot/BotSettings.cs b/StarsiegeBot/BotSettings.cs index e00d4a6..7aadd12 100644 --- a/StarsiegeBot/BotSettings.cs +++ b/StarsiegeBot/BotSettings.cs @@ -34,13 +34,15 @@ namespace StarsiegeBot { // Since we need to creat it, we're going to set some default stuff. Console.Write("Guild Settings Config File Not Found. Creating One..."); - GuildSettings item = new GuildSettings(); - item.UseAutoRoles = false; - item.UseGlobalPrefix = true; - item.UseLevelRoles = false; - item.UseLevels = false; - item.UseSelfRoles = false; - item.AllowRolesPurchase = false; + GuildSettings item = new GuildSettings + { + UseAutoRoles = false, + UseGlobalPrefix = true, + UseLevelRoles = false, + UseLevels = false, + UseSelfRoles = false, + AllowRolesPurchase = false + }; item.UseAutoRoles = false; item.LevelRoles = new Dictionary>(); item.Prefixes = new List(); diff --git a/StarsiegeBot/Commands.cs b/StarsiegeBot/Commands.cs index 31ef778..6155ce4 100644 --- a/StarsiegeBot/Commands.cs +++ b/StarsiegeBot/Commands.cs @@ -15,7 +15,7 @@ namespace StarsiegeBot private readonly Random rnd = new Random(); // start: neo wanted this shit.... - private string[] insult = { + private readonly string[] insult = { "> {0} slaps {1} around a bit with a large trout.", "> {0} puts a jellyfish on {1}'s head.", "> {0} slaps {1} around a bit with the mustache of Caanon.", diff --git a/StarsiegeBot/EventTriggers.cs b/StarsiegeBot/EventTriggers.cs index 77b1bee..7151217 100644 --- a/StarsiegeBot/EventTriggers.cs +++ b/StarsiegeBot/EventTriggers.cs @@ -1,4 +1,5 @@ -using System; +#pragma warning disable IDE0060 // Remove unused parameter +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -15,7 +16,6 @@ using DSharpPlus.VoiceNext; using Microsoft.Extensions.Logging; using Newtonsoft.Json; -#pragma warning disable IDE0060 // Remove unused parameter namespace StarsiegeBot { class Triggers diff --git a/StarsiegeBot/GlobalSuppressions.cs b/StarsiegeBot/GlobalSuppressions.cs new file mode 100644 index 0000000..d8d5194 --- /dev/null +++ b/StarsiegeBot/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "")] diff --git a/StarsiegeBot/GroupManagement.cs b/StarsiegeBot/GroupManagement.cs index f40e316..ed2a0a8 100644 --- a/StarsiegeBot/GroupManagement.cs +++ b/StarsiegeBot/GroupManagement.cs @@ -86,7 +86,7 @@ namespace StarsiegeBot public async Task EditGroup(CommandContext ctx, [RemainingText] string groupInfo) { await ctx.TriggerTypingAsync(); - string gId = ctx.Guild.Id.ToString(); + // string gId = ctx.Guild.Id.ToString(); } } diff --git a/StarsiegeBot/LevelManagement.cs b/StarsiegeBot/LevelManagement.cs index 11dbd07..3e98766 100644 --- a/StarsiegeBot/LevelManagement.cs +++ b/StarsiegeBot/LevelManagement.cs @@ -1,4 +1,5 @@ -using System; +#pragma warning disable IDE0060 // Remove unused parameter +using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; diff --git a/StarsiegeBot/LevelRoleManagement.cs b/StarsiegeBot/LevelRoleManagement.cs index c145913..fad0407 100644 --- a/StarsiegeBot/LevelRoleManagement.cs +++ b/StarsiegeBot/LevelRoleManagement.cs @@ -1,4 +1,5 @@ -using System; +#pragma warning disable IDE0060 // Remove unused parameter +using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; diff --git a/StarsiegeBot/RoleManagement.cs b/StarsiegeBot/RoleManagement.cs index fad0c90..6c1b1c4 100644 --- a/StarsiegeBot/RoleManagement.cs +++ b/StarsiegeBot/RoleManagement.cs @@ -1,4 +1,5 @@ -using System; +#pragma warning disable IDE0060 // Remove unused parameter +using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; diff --git a/StarsiegeBot/Starsiege/DeathMessages.cs b/StarsiegeBot/Starsiege/DeathMessages.cs index fa2c5bf..b17f117 100644 --- a/StarsiegeBot/Starsiege/DeathMessages.cs +++ b/StarsiegeBot/Starsiege/DeathMessages.cs @@ -79,7 +79,6 @@ namespace StarsiegeBot } } - [Command("toggle"), Aliases("t")] [RequireOwner] public async Task ToggleDM(CommandContext ctx, [RemainingText] string isEnabled = null) @@ -88,7 +87,7 @@ namespace StarsiegeBot isEnabled = isEnabled.ToLower(); - string output = ""; + string output; string[] turnOn = { "on", "true", "1" }; string[] turnOff = { "off", "false", "0" }; @@ -136,8 +135,8 @@ namespace StarsiegeBot // if there is no target, we're going to "kill" the author. if (target == null) { - int choice = rnd.Next(0, dmLines.generic.Length); - line = dmLines.generic[choice]; + int choice = rnd.Next(0, dmLines.Generic.Length); + line = dmLines.Generic[choice]; await ctx.RespondAsync(string.Format(line, ctx.Message.Author.Mention)); } // we have a valid target... Have the bot kill them. @@ -149,14 +148,14 @@ namespace StarsiegeBot if (opt == 1) { // Pick an Active death message at random, and set our output to it. - int choice = rnd.Next(0, dmLines.active.Length); - line = dmLines.active[choice]; + int choice = rnd.Next(0, dmLines.Active.Length); + line = dmLines.Active[choice]; } else if (opt == 2) { // We picked a Passive death message type. Pick the exact line at random. Set it to the output. - int choice = rnd.Next(0, dmLines.passive.Length); - line = dmLines.passive[choice]; + int choice = rnd.Next(0, dmLines.Passive.Length); + line = dmLines.Passive[choice]; } // Give the selected death message to the user. await ctx.RespondAsync(string.Format(line, ctx.Message.Author.Mention, target.Mention)); @@ -177,7 +176,7 @@ namespace StarsiegeBot // We're typing here! await ctx.TriggerTypingAsync(); // List all the types of Death Message types, and how many we have of each one. - await ctx.RespondAsync($"\r\nActive: {dmLines.active.Length}\r\nPassive: {dmLines.passive.Length}\r\nGeneric: {dmLines.generic.Length}"); + await ctx.RespondAsync($"\r\nActive: {dmLines.Active.Length}\r\nPassive: {dmLines.Passive.Length}\r\nGeneric: {dmLines.Generic.Length}"); } [Command("Add")] @@ -197,10 +196,10 @@ namespace StarsiegeBot // Message the owner know some one wants to add a new death message, along with a code block to that message. // if the Queue is null, make it exist. - if (dmLines.queue is null) - dmLines.queue = new List(); + if (dmLines.Queue is null) + dmLines.Queue = new List(); // add the message to the queue list. - dmLines.queue.Add(msg); + dmLines.Queue.Add(msg); // Store the new stuff to file... await StoreDeathMessages(); // Tell the person that the message has been added to a 'queue'. @@ -230,27 +229,27 @@ namespace StarsiegeBot using StreamWriter file = new StreamWriter("deathmessages.cs"); // Write out the total lines for each. Requirement for Starsiege. - await file.WriteLineAsync($"$deathMessage::genericCount = {dmLines.generic.Length};"); - await file.WriteLineAsync($"$deathMessage::activeCount = {dmLines.active.Length};"); - await file.WriteLineAsync($"$deathMessage::passiveCount = {dmLines.passive.Length};\r\n"); + await file.WriteLineAsync($"$deathMessage::genericCount = {dmLines.Generic.Length};"); + await file.WriteLineAsync($"$deathMessage::activeCount = {dmLines.Active.Length};"); + await file.WriteLineAsync($"$deathMessage::passiveCount = {dmLines.Passive.Length};\r\n"); // Set count to 0. Iterate over each type of Death Message, and put it into the file. int count = 0; - foreach (string death in dmLines.generic) + foreach (string death in dmLines.Generic) { await file.WriteLineAsync(string.Format($"$deathMessage::generic{count} = \"{death}\";", "%s", "%s")); count++; } // Reset the count... count = 0; - foreach (string death in dmLines.active) + foreach (string death in dmLines.Active) { await file.WriteLineAsync(string.Format($"$deathMessage::active{count} = \"{death}\";", "%s", "%s")); count++; } // Reset the count one last time... count = 0; - foreach (string death in dmLines.passive) + foreach (string death in dmLines.Passive) { await file.WriteLineAsync(string.Format($"$deathMessage::passive{count} = \"{death}\";", "%s", "%s")); count++; @@ -283,14 +282,14 @@ namespace StarsiegeBot class DeathMessageLines { [JsonProperty("active")] - public string[] active { get; set; } + public string[] Active { get; set; } [JsonProperty("passive")] - public string[] passive { get; set; } + public string[] Passive { get; set; } [JsonProperty("generic")] - public string[] generic { get; set; } - - public List flagged { get; set; } - - public List queue { get; set; } + public string[] Generic { get; set; } + [JsonProperty("flagged")] + public List Flagged { get; set; } + [JsonProperty("queue")] + public List Queue { get; set; } } } diff --git a/StarsiegeBot/Starsiege/Functions.cs b/StarsiegeBot/Starsiege/Functions.cs index ef76239..670f6d4 100644 --- a/StarsiegeBot/Starsiege/Functions.cs +++ b/StarsiegeBot/Starsiege/Functions.cs @@ -144,7 +144,7 @@ namespace StarsiegeBot isEnabled = isEnabled.ToLower(); - string output = ""; + string; string[] turnOn = { "on", "true", "1" }; string[] turnOff = { "off", "false", "0" }; diff --git a/StarsiegeBot/Starsiege/Quickchat.cs b/StarsiegeBot/Starsiege/Quickchat.cs index fd8140f..6ad3ade 100644 --- a/StarsiegeBot/Starsiege/Quickchat.cs +++ b/StarsiegeBot/Starsiege/Quickchat.cs @@ -240,7 +240,7 @@ namespace StarsiegeBot { await ctx.TriggerTypingAsync(); isEnabled = isEnabled.ToLower(); - string output = ""; + string output; string[] turnOn = { "on", "true", "1" }; string[] turnOff = { "off", "false", "0" };