conversations and customreactions have old formating. Help command improvement done.

This commit is contained in:
Master Kwoth 2016-06-18 05:27:38 +02:00
parent d3d1781584
commit 485ee3108a
4 changed files with 49 additions and 42 deletions

View File

@ -41,8 +41,11 @@ namespace NadekoBot.Modules.Help
.Parameter("module", ParameterType.Unparsed)
.Do(async e =>
{
var module = e.GetArg("module")?.Trim().ToLower();
if (string.IsNullOrWhiteSpace(module))
return;
var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
.Where(c => c.Category.ToLower() == module);
var cmdsArray = cmds as Command[] ?? cmds.ToArray();
if (!cmdsArray.Any())
{
@ -50,11 +53,14 @@ namespace NadekoBot.Modules.Help
return;
}
var i = 0;
await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" +
string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3)
.Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))))
+ $"\n```")
.ConfigureAwait(false);
if (module != "customreactions" && module != "conversations")
await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" +
string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3)
.Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))))
+ $"\n```")
.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);
});
});

View File

@ -51,8 +51,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand(Module.Prefix + "cfi")
.Alias(Module.Prefix + "channelfilterinvites")
cgb.CreateCommand(Module.Prefix + "chnlfilterinv")
.Alias(Module.Prefix + "cfi")
.Description("Enables or disables automatic deleting of invites on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfi enable #general-chat")
@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Permissions.Commands
}
});
cgb.CreateCommand(Module.Prefix + "sfi")
.Alias(Module.Prefix + "serverfilterinvites")
cgb.CreateCommand(Module.Prefix + "srvrfilterinv")
.Alias(Module.Prefix + "sfi")
.Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable")
.Parameter("bool")
.Do(async e =>

View File

@ -49,8 +49,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand(Module.Prefix + "cfw")
.Alias(Module.Prefix + "channelfilterwords")
cgb.CreateCommand(Module.Prefix + "chnlfilterwords")
.Alias(Module.Prefix + "cfw")
.Description("Enables or disables automatic deleting of messages containing banned words on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfw enable #general-chat")
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions.Commands
}
});
cgb.CreateCommand(Module.Prefix + "afw")
.Alias(Module.Prefix + "addfilteredword")
cgb.CreateCommand(Module.Prefix + "addfilterword")
.Alias(Module.Prefix + "afw")
.Description("Adds a new word to the list of filtered words" +
"\n**Usage**: ;afw poop")
.Parameter("word", ParameterType.Unparsed)
@ -108,8 +108,8 @@ namespace NadekoBot.Modules.Permissions.Commands
}
});
cgb.CreateCommand(Module.Prefix + "rfw")
.Alias(Module.Prefix + "removefilteredword")
cgb.CreateCommand(Module.Prefix + "rmvfilterword")
.Alias(Module.Prefix + "rfw")
.Description("Removes the word from the list of filtered words" +
"\n**Usage**: ;rw poop")
.Parameter("word", ParameterType.Unparsed)
@ -130,8 +130,8 @@ namespace NadekoBot.Modules.Permissions.Commands
}
});
cgb.CreateCommand(Module.Prefix + "lfw")
.Alias(Module.Prefix + "listfilteredwords")
cgb.CreateCommand(Module.Prefix + "lstfilterwords")
.Alias(Module.Prefix + "lfw")
.Description("Shows a list of filtered words" +
"\n**Usage**: ;lfw")
.Do(async e =>
@ -150,8 +150,8 @@ namespace NadekoBot.Modules.Permissions.Commands
}
});
cgb.CreateCommand(Module.Prefix + "sfw")
.Alias(Module.Prefix + "serverfilterwords")
cgb.CreateCommand(Module.Prefix + "srvrfilterwords")
.Alias(Module.Prefix + "sfw")
.Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable")
.Parameter("bool")
.Do(async e =>

View File

@ -58,8 +58,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "rpc")
.Alias(Prefix + "rolepermissionscopy")
cgb.CreateCommand(Prefix + "rolepermscopy")
.Alias(Prefix + "rpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}rpc Some Role ~ Some other role`")
.Parameter("from_to", ParameterType.Unparsed)
.Do(async e =>
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}");
}
});
cgb.CreateCommand(Prefix + "cpc")
.Alias(Prefix + "channelpermissionscopy")
cgb.CreateCommand(Prefix + "chnlpermscopy")
.Alias(Prefix + "cpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one channel to another.\n**Usage**:`{Prefix}cpc Some Channel ~ Some other channel`")
.Parameter("from_to", ParameterType.Unparsed)
.Do(async e =>
@ -114,8 +114,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}");
}
});
cgb.CreateCommand(Prefix + "upc")
.Alias(Prefix + "userpermissionscopy")
cgb.CreateCommand(Prefix + "usrpermscopy")
.Alias(Prefix + "upc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`")
.Parameter("from_to", ParameterType.Unparsed)
.Do(async e =>
@ -155,7 +155,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "serverperms")
cgb.CreateCommand(Prefix + "srvrperms")
.Alias(Prefix + "sp")
.Description("Shows banned permissions for this server.")
.Do(async e =>
@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "channelperms")
cgb.CreateCommand(Prefix + "chnlperms")
.Alias(Prefix + "cp")
.Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev")
.Parameter("channel", ParameterType.Unparsed)
@ -241,7 +241,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "sm").Alias(Prefix + "servermodule")
cgb.CreateCommand(Prefix + "srvrmdl")
.Alias(Prefix + "sm")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable")
@ -265,7 +266,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "sc").Alias(Prefix + "servercommand")
cgb.CreateCommand(Prefix + "srvrcmd").Alias(Prefix + "sc")
.Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable")
@ -289,7 +290,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "rm").Alias(Prefix + "rolemodule")
cgb.CreateCommand(Prefix + "rolemdl").Alias(Prefix + "rm")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed)
@ -327,7 +328,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "rc").Alias(Prefix + "rolecommand")
cgb.CreateCommand(Prefix + "rolecmd").Alias(Prefix + "rc")
.Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed)
@ -365,7 +366,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "cm").Alias(Prefix + "channelmodule")
cgb.CreateCommand(Prefix + "chnlmdl").Alias(Prefix + "cm")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed)
@ -408,7 +409,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "cc").Alias(Prefix + "channelcommand")
cgb.CreateCommand(Prefix + "chnlcmd").Alias(Prefix + "cc")
.Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed)
@ -446,7 +447,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "um").Alias(Prefix + "usermodule")
cgb.CreateCommand(Prefix + "usrmdl").Alias(Prefix + "um")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed)
@ -472,7 +473,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "uc").Alias(Prefix + "usercommand")
cgb.CreateCommand(Prefix + "usrcmd").Alias(Prefix + "uc")
.Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed)
@ -498,7 +499,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "asm").Alias(Prefix + "allservermodules")
cgb.CreateCommand(Prefix + "allsrvrmdls").Alias(Prefix + "asm")
.Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]")
.Do(async e =>
@ -523,7 +524,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "asc").Alias(Prefix + "allservercommands")
cgb.CreateCommand(Prefix + "allsrvrcmds").Alias(Prefix + "asc")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]")
@ -550,7 +551,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "acm").Alias(Prefix + "allchannelmodules")
cgb.CreateCommand(Prefix + "allchnlmdls").Alias(Prefix + "acm")
.Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]")
@ -578,7 +579,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "acc").Alias(Prefix + "allchannelcommands")
cgb.CreateCommand(Prefix + "allchnlcmds").Alias(Prefix + "acc")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed)
@ -606,7 +607,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "arm").Alias(Prefix + "allrolemodules")
cgb.CreateCommand(Prefix + "allrolemdls").Alias(Prefix + "arm")
.Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]")
@ -633,7 +634,7 @@ namespace NadekoBot.Modules.Permissions
}
});
cgb.CreateCommand(Prefix + "arc").Alias(Prefix + "allrolecommands")
cgb.CreateCommand(Prefix + "allrolecmds").Alias(Prefix + "arc")
.Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed)