Class HelpCommand

java.lang.Object
com.example.common.command.BaseCommand
com.example.common.command.HelpCommand
All Implemented Interfaces:
Command

public class HelpCommand extends BaseCommand
The HelpCommand class represents a command that displays all available chat commands to a client.
  • Constructor Details

    • HelpCommand

      public HelpCommand(MessageSender messageSender, ChatInterface chatInterface, CommandsInterface commands)
      Constructs a HelpCommand with the given MessageSender, ChatInterface, and CommandsInterface.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      commands - The CommandsInterface containing all chat commands.
  • Method Details

    • execute

      public Status execute(BodyMessage bodyMessage) throws IOException
      Executes the HelpCommand by sending the list of available commands to the requesting client.
      Parameters:
      bodyMessage - The BodyMessage containing the command details.
      Returns:
      The execution status of the command (SUCCESS or ERROR).
      Throws:
      IOException - if an I/O error occurs during message sending.