From 33176f894398ebe6d1b9e9c08327fd460e7d7d13 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 11 Jul 2016 13:44:19 +0200 Subject: [PATCH] >attack command clarified, commandlist updated, `.lcr all` is now a thing and sends you list of all custom reactions in DM --- .gitignore | 3 ++- NadekoBot/Classes/SearchHelper.cs | 2 +- .../Commands/CustomReactionsCommands.cs | 20 ++++++++++++++++--- NadekoBot/Modules/Help/HelpModule.cs | 4 ++++ NadekoBot/Modules/Pokemon/PokemonModule.cs | 2 +- NadekoBot/bin/Debug/data/config_example.json | 1 + 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 0b9a35ab..1dd55335 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ NadekoBot/bin/Debug/data/ServerSpecificConfigs.json NadekoBot.sln.iml .idea/workspace.xml .idea/vcs.xml -.idea/modules.xml \ No newline at end of file +.idea/modules.xml +NadekoBot/bin/Debug/data/config_xnaas.json \ No newline at end of file diff --git a/NadekoBot/Classes/SearchHelper.cs b/NadekoBot/Classes/SearchHelper.cs index 82d3d7dc..77c46151 100644 --- a/NadekoBot/Classes/SearchHelper.cs +++ b/NadekoBot/Classes/SearchHelper.cs @@ -359,7 +359,7 @@ namespace NadekoBot.Classes using (var streamWriter = new StreamWriter(await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false))) { - var json = "{\"longUrl\":\"" + url + "\"}"; + var json = "{\"longUrl\":\"" + Uri.EscapeDataString(url) + "\"}"; streamWriter.Write(json); } diff --git a/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs b/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs index 56ac5a4d..2950f8aa 100644 --- a/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs +++ b/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs @@ -2,6 +2,7 @@ using Discord.Commands; using NadekoBot.Classes; using NadekoBot.Modules.Permissions.Classes; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -46,16 +47,29 @@ namespace NadekoBot.Modules.Administration.Commands cgb.CreateCommand(Prefix + "listcustreact") .Alias(Prefix + "lcr") - .Description($"Lists all current custom reactions (paginated with 30 commands per page).\n**Usage**:{Prefix}lcr 1") + .Description($"Lists custom reactions (paginated with 30 commands per page). Use 'all' instead of page number to get all custom reactions DM-ed to you. \n**Usage**:{Prefix}lcr 1") .Parameter("num", ParameterType.Required) .Do(async e => { + var numStr = e.GetArg("num"); + + if (numStr.ToUpperInvariant() == "ALL") + { + var fullstr = String.Join("\n", NadekoBot.Config.CustomReactions.Select(kvp => kvp.Key)); + do + { + var str = string.Concat(fullstr.Take(1900)); + fullstr = new string(fullstr.Skip(1900).ToArray()); + await e.User.SendMessage("```xl\n" + str + "```"); + } while (fullstr.Length != 0); + return; + } int num; - if (!int.TryParse(e.GetArg("num"), out num) || num <= 0) num = 1; + if (!int.TryParse(numStr, out num) || num <= 0) num = 1; var cmds = GetCustomsOnPage(num - 1); if (!cmds.Any()) { - await e.Channel.SendMessage(""); + await e.Channel.SendMessage("`There are no custom reactions.`"); } else { diff --git a/NadekoBot/Modules/Help/HelpModule.cs b/NadekoBot/Modules/Help/HelpModule.cs index 0b17e336..511779c2 100644 --- a/NadekoBot/Modules/Help/HelpModule.cs +++ b/NadekoBot/Modules/Help/HelpModule.cs @@ -55,11 +55,15 @@ namespace NadekoBot.Modules.Help } var i = 0; if (module != "customreactions" && module != "conversations") + { await e.Channel.SendMessage("`List Of Commands:`\n" + SearchHelper.ShowInPrettyCode(cmdsArray, el => $"{el.Text,-15}{"[" + el.Aliases.FirstOrDefault() + "]",-8}")) .ConfigureAwait(false); + } else + { await e.Channel.SendMessage("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}"))); + } await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false); }); }); diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index 7cc90720..0e585b6d 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Pokemon commands.ForEach(cmd => cmd.Init(cgb)); cgb.CreateCommand(Prefix + "attack") - .Description("Attacks a target with the given move") + .Description($"Attacks a target with the given move. Use `{Prefix}movelist` to see a list of moves your type can use. | `{Prefix}attack \"vine whip\" @someguy`") .Parameter("move", ParameterType.Required) .Parameter("target", ParameterType.Unparsed) .Do(async e => diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index f8ff7769..469aa4c0 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -1,6 +1,7 @@ { "DontJoinServers": false, "ForwardMessages": true, + "ForwardToAllOwners": false, "IsRotatingStatus": false, "BufferSize": 4194304, "Quotes": [],