Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
I made this library a while back for use in my own server programs and games that require user input via commands. Thought some of you might find it useful.
The Command Parser Framework makes it easy to create commands with optional and required arguments, grouped parameters, validation rules, permission levels, and more.
You can make commands return errors if they are not filled out completely, and also suggest commands in case of a misspelling.
Example:
This command enables a module of a bot. It uses the enum/option functionality to limit the parameter to a set of values. If snakebot is specified, a block parameter must also be accompanied (such as !enable snakebot red).
Parser = CommandParser
.CreateNew()
.UsePrefix("!")
.OnError((o, error) => OnParseError(o, error));
Parser.AddCommand(Command
.Create("Enable")
.AddAlias("enable", "en")
.SetDescription("Enable a module of the bot.")
.SetAction((arguments, data) =>
{
var module = arguments.FromName("module");
// TODO: Actually do something
Console.WriteLine(module + " enabled!");
})
.AddArgument(Argument
.Create("module")
.AddOption(Argument.Create("snakebot")
.AddArgument(Argument.Create("block")))
.AddOption(Argument.Create("digbot"))
.AddOption(Argument.Create("guestkicker"))
.SetDefault("snakebot")
));
The command can then be used as:
(This is just a sample application. The commands would be accessible through EE chat if you called Parser.Parse(message) when a chat is received)
Links
- Project Page
- GitHub
- Tutorial & Docs
It can be downloaded from the latest release on GitHub. You can also install it through NuGet with: Install-Package Pyratron.Frameworks.Commands.Parser
Player Since 2011. I used to make bots and stuff.
Offline
Neat! I think I may try that out. Thanks buddy!
Offline
Very nice lib, kudos to you, might look into the source if you don't mind.
Offline
Very nice lib, kudos to you, might look into the source if you don't mind.
Thanks. It's on GitHub for a reason
Player Since 2011. I used to make bots and stuff.
Offline
Wrote a small library to go along with this: https://github.com/Pyratron/LogConsole
There are already a lot of logging libraries out there, but I needed this to make it so commands can be typed in the console while data is being logged. (For example, writing chat messages to the console without overwriting what you have written)
Player Since 2011. I used to make bots and stuff.
Offline
Pages: 1
[ Started around 1732784339.3164 - Generated in 0.038 seconds, 12 queries executed - Memory usage: 1.44 MiB (Peak: 1.55 MiB) ]