From 08091e74560bce0ae7286ca9dba89d8bc7d10a25 Mon Sep 17 00:00:00 2001 From: Christopher Darnell Date: Wed, 28 Apr 2021 14:16:38 -0700 Subject: [PATCH] Added in Description tags to a bunch of things. --- StarsiegeBot/BotSettings.cs | 1 + StarsiegeBot/{ => Phoenix}/GroupManagement.cs | 5 ++-- .../{ => Phoenix}/GroupRoleManagement.cs | 8 +++++-- StarsiegeBot/{ => Phoenix}/LevelManagement.cs | 5 ++++ .../{ => Phoenix}/LevelRoleManagement.cs | 5 +++- StarsiegeBot/{ => Phoenix}/RoleManagement.cs | 4 ++++ StarsiegeBot/Program.cs | 15 ++++++------ StarsiegeBot/Raven/SnappleFacts.cs | 3 ++- StarsiegeBot/Starsiege/DeathMessages.cs | 3 ++- StarsiegeBot/Starsiege/Functions.cs | 2 +- StarsiegeBot/Starsiege/GameInfo.cs | 24 +++++++++++++------ StarsiegeBot/Starsiege/Quickchat.cs | 7 ++++-- StarsiegeBot/StarsiegeBot.csproj | 1 - 13 files changed, 58 insertions(+), 25 deletions(-) rename StarsiegeBot/{ => Phoenix}/GroupManagement.cs (91%) rename StarsiegeBot/{ => Phoenix}/GroupRoleManagement.cs (63%) rename StarsiegeBot/{ => Phoenix}/LevelManagement.cs (81%) rename StarsiegeBot/{ => Phoenix}/LevelRoleManagement.cs (84%) rename StarsiegeBot/{ => Phoenix}/RoleManagement.cs (85%) diff --git a/StarsiegeBot/BotSettings.cs b/StarsiegeBot/BotSettings.cs index 7aadd12..607cd4f 100644 --- a/StarsiegeBot/BotSettings.cs +++ b/StarsiegeBot/BotSettings.cs @@ -72,6 +72,7 @@ namespace StarsiegeBot } } [GroupCommand] + [Description("Work in progress. Does nothing yet.")] public async Task BaseItem(CommandContext ctx) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/GroupManagement.cs b/StarsiegeBot/Phoenix/GroupManagement.cs similarity index 91% rename from StarsiegeBot/GroupManagement.cs rename to StarsiegeBot/Phoenix/GroupManagement.cs index ed2a0a8..9a206a0 100644 --- a/StarsiegeBot/GroupManagement.cs +++ b/StarsiegeBot/Phoenix/GroupManagement.cs @@ -49,7 +49,7 @@ namespace StarsiegeBot } [Command("add")] - public async Task AddGroup(CommandContext ctx, [RemainingText] string groupName) + public async Task AddGroup(CommandContext ctx, [RemainingText, Description("Group to create.")] string groupName) { await ctx.TriggerTypingAsync(); string gId = ctx.Guild.Id.ToString(); @@ -67,7 +67,7 @@ namespace StarsiegeBot // TODO: Delete all roles or assign new group? [Command("delete")] - public async Task RemoveGroup(CommandContext ctx, [RemainingText] string groupName) + public async Task RemoveGroup(CommandContext ctx, [RemainingText, Description("Group to delete")] string groupName) { await ctx.TriggerTypingAsync(); string gId = ctx.Guild.Id.ToString(); @@ -83,6 +83,7 @@ namespace StarsiegeBot } [Command("edit")] + [Description("This is under construction. Does nothing yet.")] public async Task EditGroup(CommandContext ctx, [RemainingText] string groupInfo) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/GroupRoleManagement.cs b/StarsiegeBot/Phoenix/GroupRoleManagement.cs similarity index 63% rename from StarsiegeBot/GroupRoleManagement.cs rename to StarsiegeBot/Phoenix/GroupRoleManagement.cs index 4d60a19..0a1dbc6 100644 --- a/StarsiegeBot/GroupRoleManagement.cs +++ b/StarsiegeBot/Phoenix/GroupRoleManagement.cs @@ -24,6 +24,7 @@ using System.Threading; namespace StarsiegeBot { [Group("GroupRole")] + [Description("Work in progress. Does nothing yet.")] [RequireGuild, RequirePermissions(Permissions.ManageRoles)] class GroupRoleManagement : BotSettings { @@ -39,7 +40,8 @@ namespace StarsiegeBot } [Command("add")] - public async Task AddSelfRole(CommandContext ctx, DiscordRole role, int price = 0, string group = null) + [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) { await ctx.TriggerTypingAsync(); if (price == -1) @@ -49,12 +51,14 @@ namespace StarsiegeBot } [Command("delete")] - public async Task DeleteSelfRole(CommandContext ctx, DiscordRole role, string group = null) + [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) { await ctx.TriggerTypingAsync(); } [Command("Edit")] + [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, DiscordRole role, int newPrice = 0, [RemainingText] string newGroup = null) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/LevelManagement.cs b/StarsiegeBot/Phoenix/LevelManagement.cs similarity index 81% rename from StarsiegeBot/LevelManagement.cs rename to StarsiegeBot/Phoenix/LevelManagement.cs index 3e98766..5b19e37 100644 --- a/StarsiegeBot/LevelManagement.cs +++ b/StarsiegeBot/Phoenix/LevelManagement.cs @@ -25,6 +25,7 @@ namespace StarsiegeBot { [Group("Level")] [RequireGuild, RequirePermissions(Permissions.ManageRoles)] + [Description("Work in progress. Does nothing yet.")] class LevelManagement : BotSettings { public LevelManagement() @@ -33,12 +34,14 @@ namespace StarsiegeBot } [GroupCommand] + [Description("Work in progress. Does nothing yet.")] public async Task ListLevels(CommandContext ctx) { await ctx.TriggerTypingAsync(); } [Command("AddLevel"), Aliases("al")] + [Description("Work in progress. Does nothing yet.")] public async Task AddLevel(CommandContext ctx, int newLevelGroup) { await ctx.TriggerTypingAsync(); @@ -46,12 +49,14 @@ namespace StarsiegeBot [Command("DeleteLevel"), Aliases("dl")] + [Description("Work in progress. Does nothing yet.")] public async Task DeleteLevel(CommandContext ctx, int oldLevelGroup) { await ctx.TriggerTypingAsync(); } [Command("edit")] + [Description("Work in progress. Does nothing yet.")] public async Task EditLevel (CommandContext ctx, int oldLeve, int newLevel) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/LevelRoleManagement.cs b/StarsiegeBot/Phoenix/LevelRoleManagement.cs similarity index 84% rename from StarsiegeBot/LevelRoleManagement.cs rename to StarsiegeBot/Phoenix/LevelRoleManagement.cs index fad0407..59cb5dd 100644 --- a/StarsiegeBot/LevelRoleManagement.cs +++ b/StarsiegeBot/Phoenix/LevelRoleManagement.cs @@ -33,28 +33,31 @@ namespace StarsiegeBot } [Command("edit")] + [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, int oldLevel, int newLevel, DiscordRole role) { await ctx.TriggerTypingAsync(); } [Command("edit")] + [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, int newLevel, [RemainingText] string role) { await ctx.TriggerTypingAsync(); } [Command("remove")] + [Description("Work in progress. Does nothing yet.")] public async Task RemoveRole(CommandContext ctx, DiscordRole role) { await ctx.TriggerTypingAsync(); } [Command("remove")] + [Description("Work in progress. Does nothing yet.")] public async Task RemoveRole(CommandContext ctx, [RemainingText] string roleName) { await ctx.TriggerTypingAsync(); } - } } diff --git a/StarsiegeBot/RoleManagement.cs b/StarsiegeBot/Phoenix/RoleManagement.cs similarity index 85% rename from StarsiegeBot/RoleManagement.cs rename to StarsiegeBot/Phoenix/RoleManagement.cs index 5a57cfc..803741c 100644 --- a/StarsiegeBot/RoleManagement.cs +++ b/StarsiegeBot/Phoenix/RoleManagement.cs @@ -33,24 +33,28 @@ namespace StarsiegeBot } [Command("join")] + [Description("Work in progress. Does nothing yet.")] public async Task JoinSelfRole(CommandContext ctx, DiscordRole role) { await ctx.TriggerTypingAsync(); } [Command("join")] + [Description("Work in progress. Does nothing yet.")] public async Task JoinSelfRole(CommandContext ctx, [RemainingText] string role) { await ctx.TriggerTypingAsync(); } [Command("leave")] + [Description("Work in progress. Does nothing yet.")] public async Task LeaveSelfRole(CommandContext ctx, DiscordRole role) { await ctx.TriggerTypingAsync(); } [Command("leave")] + [Description("Work in progress. Does nothing yet.")] public async Task LeaveSelfRole(CommandContext ctx, [RemainingText] string role) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/Program.cs b/StarsiegeBot/Program.cs index 1fe2216..144b576 100644 --- a/StarsiegeBot/Program.cs +++ b/StarsiegeBot/Program.cs @@ -115,14 +115,16 @@ namespace StarsiegeBot // up next, let's register our commands this.Commands.RegisterCommands(); - // 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(); // Main Folder. Test Items. - this.Commands.RegisterCommands(); // Main Folder. Test Items. this.Commands.RegisterCommands(); // Main Folder. Test Items. + this.Commands.RegisterCommands(); + // 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(); // Main Folder. Test Items. + // this.Commands.RegisterCommands(); // All these commands are in the STARSIEGE folder. //if (BotName.Contains("ssp")) @@ -130,7 +132,6 @@ namespace StarsiegeBot this.Commands.RegisterCommands(); this.Commands.RegisterCommands(); this.Commands.RegisterCommands(); - this.Commands.RegisterCommands(); this.Commands.RegisterCommands(); //} Task thisTimerf = StartTimer(new CancellationToken()); diff --git a/StarsiegeBot/Raven/SnappleFacts.cs b/StarsiegeBot/Raven/SnappleFacts.cs index cde3c1a..97ef7ad 100644 --- a/StarsiegeBot/Raven/SnappleFacts.cs +++ b/StarsiegeBot/Raven/SnappleFacts.cs @@ -12,7 +12,7 @@ namespace StarsiegeBot private Random rnd = new Random(); [Command("snapple"), Description("Get a Snapple \"Real Fact\".")] - public async Task Snapplefact(CommandContext ctx, int snapId = -1) + public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")]int snapId = -1) { if (snapId == -1) { @@ -36,6 +36,7 @@ namespace StarsiegeBot public SnappleFacts() { + Console.WriteLine("Snapple Commands Loaded"); this.facts = new string[] { "Animals that lay eggs don't have belly buttons.", "Beavers can hold their breath for 45 minutes under water.", "Slugs have four noses.", diff --git a/StarsiegeBot/Starsiege/DeathMessages.cs b/StarsiegeBot/Starsiege/DeathMessages.cs index b17f117..eec39f6 100644 --- a/StarsiegeBot/Starsiege/DeathMessages.cs +++ b/StarsiegeBot/Starsiege/DeathMessages.cs @@ -55,6 +55,7 @@ namespace StarsiegeBot } [Command("load")] + [RequireOwner] public async Task LoadDeathMessages(CommandContext ctx) { await ctx.TriggerTypingAsync(); @@ -263,7 +264,7 @@ namespace StarsiegeBot // Open the file to upload. FileStream sound = new FileStream($"deathmessages.cs", FileMode.Open); // Tell DSharp that we want to upload this file. - msg.WithFile(sound); + 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."; // send that message. diff --git a/StarsiegeBot/Starsiege/Functions.cs b/StarsiegeBot/Starsiege/Functions.cs index 738ec24..845b9c3 100644 --- a/StarsiegeBot/Starsiege/Functions.cs +++ b/StarsiegeBot/Starsiege/Functions.cs @@ -213,7 +213,7 @@ namespace StarsiegeBot } - return $"Name: {name} || Title: {title} || Desc: {description} || Fields: {fs}"; + return $"Name: {name} || Title: {title} || Desc: {description} || Fields: {{{fs}}}"; } } public class Fields diff --git a/StarsiegeBot/Starsiege/GameInfo.cs b/StarsiegeBot/Starsiege/GameInfo.cs index c55f20f..b056192 100644 --- a/StarsiegeBot/Starsiege/GameInfo.cs +++ b/StarsiegeBot/Starsiege/GameInfo.cs @@ -21,12 +21,14 @@ using System.Net; namespace StarsiegeBot { [Group("servers")] + [Description("Gives various reports on the game or master servers.")] class GameInfo : BaseCommandModule { private WebServerItems gameData; public GameInfo() { Update(); + Console.WriteLine("Starsiege Game Info Commands Loaded"); } private void Update() { @@ -63,11 +65,17 @@ namespace StarsiegeBot { return; } - DiscordMessageBuilder msg = new DiscordMessageBuilder(); - msg.Content = $""; + DiscordEmbedBuilder embed = new DiscordEmbedBuilder(); + embed.Title = "Master|Game Server Overview"; + embed.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); + await ctx.RespondAsync(embed); } - [Command("Errors")] + [Command("Errors"), Aliases("e")] + [Description("Lists all the errors from the server listing.")] public async Task ErrorsServer(CommandContext ctx) { await ctx.TriggerTypingAsync(); @@ -92,7 +100,8 @@ namespace StarsiegeBot await ctx.RespondAsync(msg); } - [Command("Masters")] + [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) { await ctx.TriggerTypingAsync(); @@ -120,8 +129,9 @@ namespace StarsiegeBot await ctx.RespondAsync(msg); } - [Command("games")] - public async Task GameServers(CommandContext ctx, int playerCount = 1) + [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) { await ctx.TriggerTypingAsync(); Update(); @@ -152,7 +162,7 @@ namespace StarsiegeBot } if (count == 0) { - msg.Content = "No active servers. We're sorry"; + msg.Content = "No servers matching your requirements. We're sorry"; } await ctx.RespondAsync(msg); } diff --git a/StarsiegeBot/Starsiege/Quickchat.cs b/StarsiegeBot/Starsiege/Quickchat.cs index 6ad3ade..17a2747 100644 --- a/StarsiegeBot/Starsiege/Quickchat.cs +++ b/StarsiegeBot/Starsiege/Quickchat.cs @@ -52,6 +52,7 @@ namespace StarsiegeBot } [Command("load"), RequireOwner] + [Description("[Onwer Only] Reloads the QuickChat files. If they exist. Also enables QC's if file is found.")] public async Task LoadQuickChats(CommandContext ctx) { await ctx.TriggerTypingAsync(); @@ -185,7 +186,8 @@ namespace StarsiegeBot } [Command("search"), Aliases("s")] - public async Task SearchQuickChats(CommandContext ctx, [RemainingText] string toSearch) + [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) { await ctx.TriggerTypingAsync(); // If we're disabled, let them know. And exit out. @@ -228,7 +230,7 @@ namespace StarsiegeBot { msg.Content = "Here are your results."; FileStream upload = new FileStream($"tempQC.txt", FileMode.Open); - msg.WithFile(upload); + msg.WithFile("tempQC.txt", upload); await ctx.RespondAsync(msg); upload.Close(); } @@ -236,6 +238,7 @@ namespace StarsiegeBot [Command("toggle"), Aliases("t")] [RequireOwner] + [Description("[Onwer only] Enables or disables, or checks status of QuickChats.")] public async Task ToggleQC (CommandContext ctx, [RemainingText] string isEnabled = null) { await ctx.TriggerTypingAsync(); diff --git a/StarsiegeBot/StarsiegeBot.csproj b/StarsiegeBot/StarsiegeBot.csproj index bf5347b..21b18da 100644 --- a/StarsiegeBot/StarsiegeBot.csproj +++ b/StarsiegeBot/StarsiegeBot.csproj @@ -16,7 +16,6 @@ -