Class: ChatSendAfterEventSignal
Manages callbacks that are connected to chat messages being sent.
Constructors
new ChatSendAfterEventSignal()
private
new ChatSendAfterEventSignal():ChatSendAfterEventSignal
Returns
Methods
subscribe()
subscribe(
callback
): (arg
) =>void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
Function
Parameters
Parameter | Type |
---|---|
arg | ChatSendAfterEvent |
Returns
void
Remarks
Adds a callback that will be called when new chat messages are sent.
This function can't be called in read-only mode.
Example
const chatCallback = World.beforeEvents.chatSend.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}'`;
}
});
unsubscribe()
unsubscribe(
callback
):void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
void
Remarks
Removes a callback from being called when new chat messages are sent.
This function can't be called in read-only mode.