Class ChatEventSignalBeta

Manages callbacks that are connected to chat messages being sent.

Hierarchy

  • ChatEventSignal

Constructors

Methods

Constructors

Methods

  • Parameters

    • callback: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns ((arg) => void)

      • (arg): void
      • Parameters

        Returns void

        Remarks

        Adds a callback that will be called when new chat messages are sent.

        Example

        custom_command.js

               const chatCallback = World.events.beforeChat.subscribe((eventData) => {
        if (eventData.message.includes("cancel")) {
        // Cancel event if the message contains "cancel"
        eventData.canceled = true;
        } else {
        // Modify chat message being sent
        eventData.message = `Modified '${eventData.message}'`;
        }
        });

    Remarks

    Adds a callback that will be called when new chat messages are sent.

    Example

    custom_command.js

           const chatCallback = World.events.beforeChat.subscribe((eventData) => {
    if (eventData.message.includes("cancel")) {
    // Cancel event if the message contains "cancel"
    eventData.canceled = true;
    } else {
    // Modify chat message being sent
    eventData.message = `Modified '${eventData.message}'`;
    }
    });
  • Parameters

    • callback: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns void

    Remarks

    Removes a callback from being called when new chat messages are sent.

    Throws

    This function can throw errors.