diff --git a/StarsiegeBot/BotSettings.cs b/StarsiegeBot/BotSettings.cs index 92e36eb..49d5b25 100644 --- a/StarsiegeBot/BotSettings.cs +++ b/StarsiegeBot/BotSettings.cs @@ -1,14 +1,13 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using DSharpPlus.CommandsNext; +using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.Entities; -using System.Text.RegularExpressions; -using System.Collections.Generic; using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; using System.Text; -using DSharpPlus; +using System.Text.RegularExpressions; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -86,8 +85,8 @@ namespace StarsiegeBot public bool AllowRolesPurchase { get; set; } public bool UseAutoRoles { get; set; } public List Prefixes { get; set; } - public Dictionary> SelfRoles { get; set; } - public Dictionary> LevelRoles { get; set; } + public Dictionary> SelfRoles { get; set; } + public Dictionary> LevelRoles { get; set; } public List HiddenRolesList { get; set; } public DiscordChannel WelcomeChannel { get; set; } public bool UseWelcome { get; set; } diff --git a/StarsiegeBot/EventTriggers.cs b/StarsiegeBot/EventTriggers.cs index 8deef48..043d621 100644 --- a/StarsiegeBot/EventTriggers.cs +++ b/StarsiegeBot/EventTriggers.cs @@ -1,20 +1,13 @@ #pragma warning disable IDE0060 // Remove unused parameter -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using DSharpPlus; using DSharpPlus.CommandsNext; using DSharpPlus.Entities; using DSharpPlus.EventArgs; -using DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Enums; -using DSharpPlus.Interactivity.Extensions; -using DSharpPlus.VoiceNext; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -225,7 +218,7 @@ namespace StarsiegeBot { d.Logger.LogDebug(BotEventId, "GuildDownloadCompleted."); //if(e.Guilds[376937422010974209].Members.ContainsKey(139548200099905536)) - //notify = e.Guilds[376937422010974209].Members[139548200099905536]; + //notify = e.Guilds[376937422010974209].Members[139548200099905536]; return Task.CompletedTask; } @@ -255,7 +248,7 @@ namespace StarsiegeBot string msg = WelcomeMessage.WelcomeMessageProcessing(BotSettings.GuildSettings[gId].WelcomeMessage, e.Member, e.Guild); BotSettings.GuildSettings[gId].WelcomeChannel.SendMessageAsync(msg); } - + return Task.CompletedTask; } public Task GuildMemberRemoved(DiscordClient d, GuildMemberRemoveEventArgs e) diff --git a/StarsiegeBot/StarsiegeCommands.cs b/StarsiegeBot/ExperiemntalCommands.cs similarity index 88% rename from StarsiegeBot/StarsiegeCommands.cs rename to StarsiegeBot/ExperiemntalCommands.cs index 33084de..957496d 100644 --- a/StarsiegeBot/StarsiegeCommands.cs +++ b/StarsiegeBot/ExperiemntalCommands.cs @@ -1,35 +1,27 @@ -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 DSharpPlus.Interactivity; using DSharpPlus.Interactivity.Extensions; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; namespace StarsiegeBot { [Group("ex")] [Hidden] - + [Description("Experimental commands. May break the bot.")] - class StarsiegeCommands : BaseCommandModule + class ExperiemntalCommands : BaseCommandModule { private readonly List QuizQuestions; private readonly Random rnd = new Random(); - public StarsiegeCommands() + public ExperiemntalCommands() { // Load all the Quick Chat texts and sound wav file info. var json = ""; @@ -48,7 +40,7 @@ namespace StarsiegeBot await ctx.TriggerTypingAsync(); DiscordEmbedBuilder embed = new DiscordEmbedBuilder(); - int[] ids = { rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count)}; + int[] ids = { rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count) }; int selection = rnd.Next(ids.Length); int mainId = ids[selection]; string[] options = { "a", "b", "c", "d" }; @@ -71,7 +63,7 @@ namespace StarsiegeBot var itemEmote = DiscordEmoji.FromName(ctx.Client, $":regional_indicator_{item}:"); await message.CreateReactionAsync(itemEmote); } - var result = message.WaitForReactionAsync(ctx.Message.Author,TimeSpan.FromSeconds(5d)); + var result = message.WaitForReactionAsync(ctx.Message.Author, TimeSpan.FromSeconds(5d)); if (!result.Result.TimedOut) { if (result.Result.Result.Emoji == correctAnswer) await ctx.RespondAsync("**CORRECT!!**"); @@ -95,7 +87,7 @@ namespace StarsiegeBot { foreach (var person in reaction.Users) { - if ( ! correctEmote.Equals(reaction.Emoji)) + if (!correctEmote.Equals(reaction.Emoji)) { losers.Add(person, true); } diff --git a/StarsiegeBot/Commands.cs b/StarsiegeBot/GameCommands.cs similarity index 96% rename from StarsiegeBot/Commands.cs rename to StarsiegeBot/GameCommands.cs index 264585c..dd53834 100644 --- a/StarsiegeBot/Commands.cs +++ b/StarsiegeBot/GameCommands.cs @@ -1,16 +1,16 @@ #pragma warning disable IDE0060 // Remove unused parameter -using System; -using System.Threading.Tasks; using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.Entities; -using System.Text.RegularExpressions; -using System.Linq; +using System; using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; namespace StarsiegeBot { - class Commands : BaseCommandModule + class GameCommands : BaseCommandModule { // Master insult list. private readonly string[] InsultMaster = { @@ -22,7 +22,7 @@ namespace StarsiegeBot }; private List InsultCopy; - public Commands() + public GameCommands() { // Let the console know we've loaded basic commands. Console.WriteLine("Basic Commands Loaded"); @@ -174,11 +174,11 @@ namespace StarsiegeBot else await ctx.RespondAsync(overallResults); } - [Command("guilds"),Hidden,RequireOwner] - public async Task GimmeServerNames (CommandContext ctx) + [Command("guilds"), Hidden, RequireOwner] + public async Task GimmeServerNames(CommandContext ctx) { string output = ""; - foreach (KeyValuePair item in ctx.Client.Guilds) + foreach (KeyValuePair item in ctx.Client.Guilds) { output += item.Value.Name + "\r\n"; } @@ -382,7 +382,7 @@ namespace StarsiegeBot if (msg != "") result = msg; else - result ="I need something to say..."; + result = "I need something to say..."; DiscordEmbedBuilder embed = new DiscordEmbedBuilder { Description = result, diff --git a/StarsiegeBot/Phoenix/GroupManagement.cs b/StarsiegeBot/Phoenix/GroupManagement.cs index 9a206a0..d0cb477 100644 --- a/StarsiegeBot/Phoenix/GroupManagement.cs +++ b/StarsiegeBot/Phoenix/GroupManagement.cs @@ -1,25 +1,12 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; namespace StarsiegeBot { diff --git a/StarsiegeBot/Phoenix/GroupRoleManagement.cs b/StarsiegeBot/Phoenix/GroupRoleManagement.cs index 0a1dbc6..ec2a6b1 100644 --- a/StarsiegeBot/Phoenix/GroupRoleManagement.cs +++ b/StarsiegeBot/Phoenix/GroupRoleManagement.cs @@ -1,25 +1,11 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -41,7 +27,7 @@ namespace StarsiegeBot [Command("add")] [Description("Work in progress. Does nothing yet.")] - public async Task AddSelfRole(CommandContext ctx, [Description("The role to add.")]DiscordRole role, [Description("The price of the role for buyable roles. 0 for no cost. Free free to leave blank if not using Buyable roles.")]int price = 0, [Description("What group to put the role in. If not using groups, you can leave blank.")]string group = null) + public async Task AddSelfRole(CommandContext ctx, [Description("The role to add.")] DiscordRole role, [Description("The price of the role for buyable roles. 0 for no cost. Free free to leave blank if not using Buyable roles.")] int price = 0, [Description("What group to put the role in. If not using groups, you can leave blank.")] string group = null) { await ctx.TriggerTypingAsync(); if (price == -1) @@ -52,7 +38,7 @@ namespace StarsiegeBot [Command("delete")] [Description("Work in progress. Does nothing yet.")] - public async Task DeleteSelfRole(CommandContext ctx, [Description("The role to delete.")] DiscordRole role, [Description("The group to remove the role from. If left blank, will remove from all groups.")]string group = null) + public async Task DeleteSelfRole(CommandContext ctx, [Description("The role to delete.")] DiscordRole role, [Description("The group to remove the role from. If left blank, will remove from all groups.")] string group = null) { await ctx.TriggerTypingAsync(); } diff --git a/StarsiegeBot/Phoenix/LevelManagement.cs b/StarsiegeBot/Phoenix/LevelManagement.cs index 5b19e37..8f3895b 100644 --- a/StarsiegeBot/Phoenix/LevelManagement.cs +++ b/StarsiegeBot/Phoenix/LevelManagement.cs @@ -1,25 +1,10 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -57,7 +42,7 @@ namespace StarsiegeBot [Command("edit")] [Description("Work in progress. Does nothing yet.")] - public async Task EditLevel (CommandContext ctx, int oldLeve, int newLevel) + public async Task EditLevel(CommandContext ctx, int oldLeve, int newLevel) { await ctx.TriggerTypingAsync(); } diff --git a/StarsiegeBot/Phoenix/LevelRoleManagement.cs b/StarsiegeBot/Phoenix/LevelRoleManagement.cs index 59cb5dd..0ff56fc 100644 --- a/StarsiegeBot/Phoenix/LevelRoleManagement.cs +++ b/StarsiegeBot/Phoenix/LevelRoleManagement.cs @@ -1,25 +1,11 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot { diff --git a/StarsiegeBot/Phoenix/RoleManagement.cs b/StarsiegeBot/Phoenix/RoleManagement.cs index 803741c..ff844c7 100644 --- a/StarsiegeBot/Phoenix/RoleManagement.cs +++ b/StarsiegeBot/Phoenix/RoleManagement.cs @@ -1,30 +1,16 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot -{ +{ [Group("role")] - [RequireGuild,RequirePermissions(Permissions.ManageRoles)] + [RequireGuild, RequirePermissions(Permissions.ManageRoles)] class RoleManagement : BotSettings { public RoleManagement() diff --git a/StarsiegeBot/PrefixManagement.cs b/StarsiegeBot/PrefixManagement.cs index ec7b524..994608d 100644 --- a/StarsiegeBot/PrefixManagement.cs +++ b/StarsiegeBot/PrefixManagement.cs @@ -1,24 +1,11 @@ -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -120,7 +107,7 @@ namespace StarsiegeBot await ctx.RespondAsync($"Global Prefix usage has been turned **{(isEnabled ? "on" : "off")}**"); } [Command("global")] - public async Task UseGlobalPrefixes(CommandContext ctx, [Description("ON or OFF"),RemainingText] string isEnabled = null) + public async Task UseGlobalPrefixes(CommandContext ctx, [Description("ON or OFF"), RemainingText] string isEnabled = null) { await ctx.TriggerTypingAsync(); isEnabled = isEnabled.ToLower(); @@ -151,7 +138,7 @@ namespace StarsiegeBot } else { - + } await ctx.RespondAsync(embed); } diff --git a/StarsiegeBot/Program.cs b/StarsiegeBot/Program.cs index 53b8baa..02f01e8 100644 --- a/StarsiegeBot/Program.cs +++ b/StarsiegeBot/Program.cs @@ -1,19 +1,16 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using DSharpPlus; +using DSharpPlus; using DSharpPlus.CommandsNext; using DSharpPlus.Entities; -using DSharpPlus.EventArgs; using DSharpPlus.Interactivity; using DSharpPlus.Interactivity.Enums; using DSharpPlus.Interactivity.Extensions; using DSharpPlus.VoiceNext; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -122,16 +119,16 @@ namespace StarsiegeBot // up next, let's register our commands this.Commands.RegisterCommands(); // Main Folder. Test Items. - this.Commands.RegisterCommands(); + this.Commands.RegisterCommands(); // Experimental commands file. + this.Commands.RegisterCommands(); this.Commands.RegisterCommands(); // Main Folder. Test Items. this.Commands.RegisterCommands(); // Main Folder. Test Items. this.Commands.RegisterCommands(); // Main Folder. Test Items. this.Commands.RegisterCommands(); // Main Folder. Test Items. + this.Commands.RegisterCommands(); // Raven Folder. this.Commands.RegisterCommands(); this.Commands.RegisterCommands(); // Main Folder. Test Items. - this.Commands.RegisterCommands(); - this.Commands.RegisterCommands(); - this.Commands.RegisterCommands(); + this.Commands.RegisterCommands(); // Raven folder. this.Commands.RegisterCommands(); // Main Folder. Test Items. // All these commands are in the STARSIEGE folder. diff --git a/StarsiegeBot/Raven/NotFacts.cs b/StarsiegeBot/Raven/NotFacts.cs index 733b9bc..c01da0c 100644 --- a/StarsiegeBot/Raven/NotFacts.cs +++ b/StarsiegeBot/Raven/NotFacts.cs @@ -1,17 +1,17 @@ -using System; +using DSharpPlus.CommandsNext; +using DSharpPlus.CommandsNext.Attributes; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using DSharpPlus.CommandsNext; -using DSharpPlus.CommandsNext.Attributes; -using Newtonsoft.Json; namespace StarsiegeBot { class NotFacts : BaseCommandModule { - private List notfacts; + private readonly List notfacts; public NotFacts() { @@ -31,7 +31,7 @@ namespace StarsiegeBot await ctx.RespondAsync(notfacts[notFactID]); return; } - catch(Exception) + catch (Exception) { await ctx.RespondAsync(notfacts[Program.rnd.Next(0, notfacts.Count)]); } diff --git a/StarsiegeBot/Raven/SnappleFacts.cs b/StarsiegeBot/Raven/SnappleFacts.cs index 2bdf774..36250a1 100644 --- a/StarsiegeBot/Raven/SnappleFacts.cs +++ b/StarsiegeBot/Raven/SnappleFacts.cs @@ -1,17 +1,17 @@ -using System; +using DSharpPlus.CommandsNext; +using DSharpPlus.CommandsNext.Attributes; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using DSharpPlus.CommandsNext; -using DSharpPlus.CommandsNext.Attributes; -using Newtonsoft.Json; namespace StarsiegeBot { class SnappleFacts : BaseCommandModule { - private List facts; + private readonly List facts; public SnappleFacts() { @@ -21,7 +21,7 @@ namespace StarsiegeBot } [Command("snapple"), Description("Get a Snapple \"Real Fact\".")] - public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")]int snapId = -1) + public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")] int snapId = -1) { await ctx.TriggerTypingAsync(); @@ -31,7 +31,7 @@ namespace StarsiegeBot await ctx.RespondAsync(facts[snapId]); return; } - catch(Exception) + catch (Exception) { await ctx.RespondAsync(facts[Program.rnd.Next(0, facts.Count)]); } diff --git a/StarsiegeBot/Starsiege/DeathMessages.cs b/StarsiegeBot/Starsiege/DeathMessages.cs index 157063d..2e67334 100644 --- a/StarsiegeBot/Starsiege/DeathMessages.cs +++ b/StarsiegeBot/Starsiege/DeathMessages.cs @@ -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. diff --git a/StarsiegeBot/Starsiege/Functions.cs b/StarsiegeBot/Starsiege/Functions.cs index dad68ae..7aa5019 100644 --- a/StarsiegeBot/Starsiege/Functions.cs +++ b/StarsiegeBot/Starsiege/Functions.cs @@ -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 { diff --git a/StarsiegeBot/Starsiege/GameInfo.cs b/StarsiegeBot/Starsiege/GameInfo.cs index 187f5cd..bd50396 100644 --- a/StarsiegeBot/Starsiege/GameInfo.cs +++ b/StarsiegeBot/Starsiege/GameInfo.cs @@ -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; } diff --git a/StarsiegeBot/Starsiege/QuickchatHandler.cs b/StarsiegeBot/Starsiege/QuickchatHandler.cs index 8f14d21..a4f5553 100644 --- a/StarsiegeBot/Starsiege/QuickchatHandler.cs +++ b/StarsiegeBot/Starsiege/QuickchatHandler.cs @@ -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>(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 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 { diff --git a/StarsiegeBot/WelcomeMessage.cs b/StarsiegeBot/WelcomeMessage.cs index 10a417f..8660fe9 100644 --- a/StarsiegeBot/WelcomeMessage.cs +++ b/StarsiegeBot/WelcomeMessage.cs @@ -1,25 +1,11 @@ #pragma warning disable IDE0060 // Remove unused parameter -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; 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 DSharpPlus.Interactivity; -using DSharpPlus.Interactivity.Extensions; -using System.Threading; +using System.Threading.Tasks; namespace StarsiegeBot { @@ -28,7 +14,7 @@ namespace StarsiegeBot class WelcomeMessage : BotSettings { [GroupCommand] - public async Task GeneralWelcome (CommandContext ctx) + public async Task GeneralWelcome(CommandContext ctx) { await ctx.TriggerTypingAsync(); string gId = ctx.Guild.Id.ToString(); @@ -89,7 +75,7 @@ namespace StarsiegeBot await ctx.RespondAsync(embed); } [Command("Channel")] - public async Task WelcomeChannel(CommandContext ctx, [RemainingText]string here) + public async Task WelcomeChannel(CommandContext ctx, [RemainingText] string here) { await ctx.TriggerTypingAsync(); string gId = ctx.Guild.Id.ToString(); @@ -109,7 +95,7 @@ namespace StarsiegeBot } [Command("Message")] [Description("Hello. Run `>welcome help` for more info.")] - public async Task MessageOfWelcome(CommandContext ctx, [RemainingText]string msg) + public async Task MessageOfWelcome(CommandContext ctx, [RemainingText] string msg) { await ctx.TriggerTypingAsync(); string gId = ctx.Guild.Id.ToString();