From 14373cd1e04e24602bf910c886ac9f3906536f04 Mon Sep 17 00:00:00 2001 From: Toni Fasth Date: Mon, 16 Aug 2021 20:20:09 +0300 Subject: [PATCH] Removed extra commands and added descriptions --- UPBot Code/Commands/Game.cs | 39 +++++++++---------------------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/UPBot Code/Commands/Game.cs b/UPBot Code/Commands/Game.cs index cf9aee6..95e2a94 100644 --- a/UPBot Code/Commands/Game.cs +++ b/UPBot Code/Commands/Game.cs @@ -13,40 +13,22 @@ /// public class GameModule : BaseCommandModule { - [Command("game")] - public async Task GameCommand(CommandContext ctx) - { - UtilityFunctions.LogUserCommand(ctx); - StringBuilder sb = new StringBuilder("Available game commmands\n"); - sb.AppendLine("========================"); - sb.AppendLine(String.Format("{0, -10}: {1}", "bool", "True or False")); - sb.AppendLine(String.Format("{0, -10}: {1}", "rps", "Rock, Paper, Scissors")); - - await ctx.RespondAsync(String.Format("```{0}```", sb.ToString())); - } - [Command("bool")] + [Description("Returns True or False")] public async Task BoolCommand(CommandContext ctx) { - UtilityFunctions.LogUserCommand(ctx); - await PlayBool(ctx); - } - - [Command("rps")] - public async Task RPSCommand(CommandContext ctx, string kind) - { - UtilityFunctions.LogUserCommand(ctx); - await PlayRockPaperScissors(ctx, kind); + UtilityFunctions.LogUserCommand(ctx); + await PlayBool(ctx); } [Command("rps")] - public async Task RPSCommand(CommandContext ctx) + [Description("Play Rock, Paper, Scissors")] + public async Task RPSCommand(CommandContext ctx, [Description("rock | paper | scissors")] string kind) { - UtilityFunctions.LogUserCommand(ctx); - await PlayRockPaperScissors(ctx, null); + UtilityFunctions.LogUserCommand(ctx); + await PlayRockPaperScissors(ctx, kind); } - readonly Random random = new Random(); Task PlayBool(CommandContext ctx) @@ -60,7 +42,6 @@ Task PlayBool(CommandContext ctx) default: return ctx.RespondAsync("false"); } - } enum RPSTypes : ushort @@ -72,9 +53,6 @@ enum RPSTypes : ushort Task PlayRockPaperScissors(CommandContext ctx, string kind) { - if (kind == null) - return ctx.RespondAsync("```\nRock Paper Scissors\nUsage pattern: rps [rock|paper|scissors]\n```"); - RPSTypes playerChoice; switch(kind) @@ -96,7 +74,8 @@ Task PlayRockPaperScissors(CommandContext ctx, string kind) if(playerChoice == botChoice) { - return ctx.RespondAsync("@@@\nDRAW!".Replace("@@@", botChoice.ToString())); + //return ctx.RespondAsync("@@@\nDRAW!".Replace("@@@", botChoice.ToString())); + return ctx.Channel.SendMessageAsync(ctx.Member.Mention + "\n@@@\nDRAW!".Replace("@@@", botChoice.ToString())); } if(playerChoice == RPSTypes.Rock && botChoice == RPSTypes.Scissors) {