Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] how to use ChatBot.ChatBotCommand?or how to add a mcc command #2764

Open
moran0710 opened this issue Jul 18, 2024 · 0 comments
Open

Comments

@moran0710
Copy link

hi
i am learning to make a chatbot with mcc.
i found ChatBotCommand in chatbot.cs ,but i dont know how to use it.
Please tell me how to use this class,or other way to register a command,thanks a lot.

My attempt is as follows

using MinecraftClient.Scripting;

namespace MinecraftClient.ChatBots;

public class MyBot : ChatBot
{
    public override void Initialize()
    {
        base.Initialize();
        
        new ChatBotCommand("test", "print a test message", "", new CommandRunner(RunTest));//or maybe i need pass this object into a registration method?
        LogToConsole("Bot Loaded");  // this message can be printed
    }

    public string RunTest(string command, string[] args)
    {
        LogToConsole("it work!");
        return "end";
    }
}

and it dosent work ;(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant