>attack command clarified, commandlist updated, .lcr all is now a thing and sends you list of all custom reactions in DM

This commit is contained in:
Master Kwoth 2016-07-11 13:44:19 +02:00
parent 57bc26dd46
commit 33176f8943
6 changed files with 26 additions and 6 deletions

3
.gitignore vendored
View File

@ -40,4 +40,5 @@ NadekoBot/bin/Debug/data/ServerSpecificConfigs.json
NadekoBot.sln.iml NadekoBot.sln.iml
.idea/workspace.xml .idea/workspace.xml
.idea/vcs.xml .idea/vcs.xml
.idea/modules.xml .idea/modules.xml
NadekoBot/bin/Debug/data/config_xnaas.json

View File

@ -359,7 +359,7 @@ namespace NadekoBot.Classes
using (var streamWriter = new StreamWriter(await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false))) using (var streamWriter = new StreamWriter(await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)))
{ {
var json = "{\"longUrl\":\"" + url + "\"}"; var json = "{\"longUrl\":\"" + Uri.EscapeDataString(url) + "\"}";
streamWriter.Write(json); streamWriter.Write(json);
} }

View File

@ -2,6 +2,7 @@
using Discord.Commands; using Discord.Commands;
using NadekoBot.Classes; using NadekoBot.Classes;
using NadekoBot.Modules.Permissions.Classes; using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -46,16 +47,29 @@ namespace NadekoBot.Modules.Administration.Commands
cgb.CreateCommand(Prefix + "listcustreact") cgb.CreateCommand(Prefix + "listcustreact")
.Alias(Prefix + "lcr") .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) .Parameter("num", ParameterType.Required)
.Do(async e => .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; 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); var cmds = GetCustomsOnPage(num - 1);
if (!cmds.Any()) if (!cmds.Any())
{ {
await e.Channel.SendMessage(""); await e.Channel.SendMessage("`There are no custom reactions.`");
} }
else else
{ {

View File

@ -55,11 +55,15 @@ namespace NadekoBot.Modules.Help
} }
var i = 0; var i = 0;
if (module != "customreactions" && module != "conversations") if (module != "customreactions" && module != "conversations")
{
await e.Channel.SendMessage("`List Of Commands:`\n" + SearchHelper.ShowInPrettyCode<Command>(cmdsArray, await e.Channel.SendMessage("`List Of Commands:`\n" + SearchHelper.ShowInPrettyCode<Command>(cmdsArray,
el => $"{el.Text,-15}{"[" + el.Aliases.FirstOrDefault() + "]",-8}")) el => $"{el.Text,-15}{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))
.ConfigureAwait(false); .ConfigureAwait(false);
}
else else
{
await e.Channel.SendMessage("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}"))); 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); await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false);
}); });
}); });

View File

@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Pokemon
commands.ForEach(cmd => cmd.Init(cgb)); commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(Prefix + "attack") 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("move", ParameterType.Required)
.Parameter("target", ParameterType.Unparsed) .Parameter("target", ParameterType.Unparsed)
.Do(async e => .Do(async e =>

View File

@ -1,6 +1,7 @@
{ {
"DontJoinServers": false, "DontJoinServers": false,
"ForwardMessages": true, "ForwardMessages": true,
"ForwardToAllOwners": false,
"IsRotatingStatus": false, "IsRotatingStatus": false,
"BufferSize": 4194304, "BufferSize": 4194304,
"Quotes": [], "Quotes": [],