Skip to content

qluana7/CommandExecutor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommandExecutor

Feature

  • Executor register all method that inherit CommandModule.
  • Can execute commands with only string.
  • String will automatically change to parameter type.
  • Provides set arguments count for array.

Example

First, declare executor class.

// in Main method

Executor executor = new(new ExecutorConfiguration() {
    IgnoreCase = true,
    IgnoreExtraArguments = false,
    GetPrivateMethod = false
});

Second, create class that inheriting CommandModule.

// outisde of Main class

public class BasicCommand : CommandModule
{
    // You can set command name and alias.
    [Command]
    public void Hello(string person)
    {
        Console.WriteLine($"Hello, {person}!");
    }
}

Third, register class.

// in Main method

executor.RegisterCommands<BasicCommand>();

Last, execute commands with string.

// in Main method

executor.Execute("Hello World");

Then, it execute 'Hello' method with arguments "World"

See Example Code

Current Staute of New Features

  • Add GetAllCommands method and GetCommands method
    • Providing registered commands array
  • Events
    • CommandErrored
    • CommandExecuted
  • Support override method
  • Support SubCommand (or GroupCommand)

Contact

Compile Information

Framework version : Standard 2.1 / .NET 5.0

Reference

Referred the source of the following repo

About

The powerful tools for managing commands.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages