fixes, ne help command for easy readme

This commit is contained in:
Kwoth 2016-01-05 15:37:43 +01:00
parent 80827f0853
commit da086011f8
7 changed files with 39 additions and 15 deletions

View File

@ -68,7 +68,7 @@ namespace NadekoBot
public override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand("t")
.Description("Starts a game of trivia. Questions suck and repeat a lot atm.")
.Description("Starts a game of trivia.")
.Alias("-t")
.Do(DoFunc());

View File

@ -88,7 +88,7 @@ namespace NadekoBot
public override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand("$roll")
.Description("Rolls 2 dice from 0-10. If you supply a number [x] it rolls up to 30 normal dice.\nUsage: $roll [x]")
.Description("Rolls 2 dice from 0-10. If you supply a number [x] it rolls up to 30 normal dice.\n**Usage**: $roll [x]")
.Parameter("num", ParameterType.Optional)
.Do(DoFunc());
}

View File

@ -63,7 +63,7 @@ namespace NadekoBot
public override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand("$draw")
.Description("Draws a card from the deck.If you supply number [x], she draws up to 5 cards from the deck.\nUsage: $draw [x]")
.Description("Draws a card from the deck.If you supply number [x], she draws up to 5 cards from the deck.\n**Usage**: $draw [x]")
.Parameter("count", ParameterType.Optional)
.Do(DoFunc());
}

View File

@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Discord.Commands;
using Discord.Legacy;
using System.IO;
namespace NadekoBot
{
@ -31,12 +32,34 @@ namespace NadekoBot
await e.User.Send(helpstr);
};
public Action<CommandEventArgs> DoGitFunc() => e => {
string helpstr = "Official repo: **github.com/Kwoth/NadekoBot/** \n";
string lastCategory = "";
foreach (var com in client.Commands().AllCommands) {
if (com.Category != lastCategory) {
helpstr += "\n### " + com.Category + " \n";
helpstr += "Command [alias] | Description | Usage\n";
helpstr += "----------------|--------------|-------\n";
lastCategory = com.Category;
}
helpstr += PrintCommandHelp(com);
}
helpstr = helpstr.Replace(NadekoBot.botMention, "@BotName");
helpstr = helpstr.Replace("\n**Usage**:", " | ").Replace("**Usage**:", " | ").Replace("**Description:**", " | ").Replace("\n|", " | \n");
File.WriteAllText("readme.md",helpstr);
return;
};
public override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand("-h")
.Alias(new string[] { "-help", NadekoBot.botMention + " help", NadekoBot.botMention + " h" })
.Description("Help command")
.Do(DoFunc());
cgb.CreateCommand("-hgit")
.Description("Help command stylized for github readme")
.Do(DoGitFunc());
}
private string PrintCommandHelp(Command com)

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Modules
commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(".sr").Alias(".setrole")
.Description("Sets a role for a given user.\nUsage: .sr @User Guest")
.Description("Sets a role for a given user.\n**Usage**: .sr @User Guest")
.Parameter("user_name", Discord.Commands.ParameterType.Required)
.Parameter("role_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
@ -52,7 +52,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".rr").Alias(".removerole")
.Description("Removes a role from a given user.\nUsage: .rr @User Admin")
.Description("Removes a role from a given user.\n**Usage**: .rr @User Admin")
.Parameter("user_name", Discord.Commands.ParameterType.Required)
.Parameter("role_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
@ -87,7 +87,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".r").Alias(".role").Alias(".cr")
.Description("Creates a role with a given name, and color.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Creates a role with a given name, and color.")
.Parameter("role_name",Discord.Commands.ParameterType.Required)
.Parameter("role_color",Discord.Commands.ParameterType.Optional)
.Do(async e =>
@ -123,7 +123,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".b").Alias(".ban")
.Description("Kicks a mentioned user\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Kicks a mentioned user")
.Do(async e =>
{
try
@ -143,7 +143,7 @@ namespace NadekoBot.Modules
cgb.CreateCommand(".k").Alias(".kick")
.Parameter("user")
.Description("Kicks a mentioned user.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Kicks a mentioned user.")
.Do(async e =>
{
try
@ -162,7 +162,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".rvch")
.Description("Removes a voice channel with a given name.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Removes a voice channel with a given name.")
.Parameter("channel_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
{
@ -181,7 +181,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".vch").Alias(".cvch")
.Description("Creates a new voice channel with a given name.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Creates a new voice channel with a given name.")
.Parameter("channel_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
{
@ -200,7 +200,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".rch").Alias(".rtch")
.Description("Removes a text channel with a given name.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Removes a text channel with a given name.")
.Parameter("channel_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
{
@ -219,7 +219,7 @@ namespace NadekoBot.Modules
});
cgb.CreateCommand(".ch").Alias(".tch")
.Description("Creates a new text channel with a given name.\n*Both the user and the bot must have the sufficient permissions.*")
.Description("Creates a new text channel with a given name.")
.Parameter("channel_name", Discord.Commands.ParameterType.Required)
.Do(async e =>
{

View File

@ -20,7 +20,7 @@ namespace NadekoBot.Modules
{
commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(">")
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: @BotName strike @User")
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: > strike @User")
.Parameter("attack_type",Discord.Commands.ParameterType.Required)
.Parameter("target",Discord.Commands.ParameterType.Required)
.Do(async e =>
@ -43,6 +43,7 @@ namespace NadekoBot.Modules
cgb.CreateCommand("poketype")
.Parameter("target", Discord.Commands.ParameterType.Required)
.Description("Gets the users element type. Use this to do more damage with strike")
.Do(async e =>
{
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();

View File

@ -84,7 +84,7 @@ namespace NadekoBot.Modules {
});
cgb.CreateCommand("testq")
.Description("Queue a song using a multi/single word name.\nUsage: `!m q Dream Of Venice`")
.Description("Queue a song using a multi/single word name.\n**Usage**: `!m q Dream Of Venice`")
.Parameter("Query", ParameterType.Unparsed)
.Do(async e => {
var youtube = YouTube.Default;
@ -100,7 +100,7 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("q")
.Alias("yq")
.Description("Queue a song using a multi/single word name.\nUsage: `!m q Dream Of Venice`")
.Description("Queue a song using a multi/single word name.\n**Usage**: `!m q Dream Of Venice`")
.Parameter("Query", ParameterType.Unparsed)
.Do(async e => {
var youtube = YouTube.Default;