Fixed a lot of the thigs that Visual Studio was whining about. Suppressed a few warnings. Added supression to unused variable warnings to each file.

This commit is contained in:
Christopher Darnell committed 2021-04-26 18:05:23 -07:00
1 parent b2d6cff5ed
commit 843261cf68
11 files changed
+53 -41

No files matched your search

+9 -7
View File
@@ -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<int, List<DiscordRole>>();
item.Prefixes = new List<string>();
+1 -1
View File
@@ -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.",
+2 -2
View File
@@ -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
+8
View File
@@ -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 = "<Pending>")]
+1 -1
View File
@@ -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();
}
}
+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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;
+24 -25
View File
@@ -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<string>();
if (dmLines.Queue is null)
dmLines.Queue = new List<string>();
// 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<String> flagged { get; set; }
public List<String> queue { get; set; }
public string[] Generic { get; set; }
[JsonProperty("flagged")]
public List<String> Flagged { get; set; }
[JsonProperty("queue")]
public List<String> Queue { get; set; }
}
}
+1 -1
View File
@@ -144,7 +144,7 @@ namespace StarsiegeBot
isEnabled = isEnabled.ToLower();
string output = "";
string;
string[] turnOn = { "on", "true", "1" };
string[] turnOff = { "off", "false", "0" };
+1 -1
View File
@@ -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" };