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

Refactor command executors to use classes #157

Closed
WinG4merBR opened this issue Oct 18, 2024 · 0 comments · Fixed by #159
Closed

Refactor command executors to use classes #157

WinG4merBR opened this issue Oct 18, 2024 · 0 comments · Fixed by #159
Assignees
Labels
Module: Command Executors Priority: Low Doesn't need that much attention

Comments

@WinG4merBR
Copy link
Member

WinG4merBR commented Oct 18, 2024

Currently, some commands in Foxy are implemented as functions. To enhance maintainability, readability, and ensure consistent patterns throughout the codebase, these command executors need to be refactored to use classes.

The command executors and declarators are located in the directory foxy/parent/src/command/vanilla/category/.

⚠️ Important:

Carefully handle the types during this refactoring. Ensure the context parameter is correctly typed as UnleashedCommandExecutor.

Implementation Pattern:

The command should follow this structure:

export default class CommandName {
    async execute(context: UnleashedCommandExecutor, endCommand, t) {
        // Command logic 

        // Feel free to add additional methods as needed to improve readability
    }
}

Additionally, it needs to be declared in the corresponding file located in the command/vanilla/category/declarations directory as follows:

execute: async (context: UnleashedCommandExecutor, endCommand, t) => {
    new CommandName().execute(context, endCommand, t);
}

H4PPY C0D1NG! 🎉

@WinG4merBR WinG4merBR added Priority: Low Doesn't need that much attention Module: Command Executors labels Oct 18, 2024
@WinG4merBR WinG4merBR pinned this issue Oct 23, 2024
@WinG4merBR WinG4merBR self-assigned this Oct 23, 2024
@WinG4merBR WinG4merBR linked a pull request Nov 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Command Executors Priority: Low Doesn't need that much attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant