Namespace: CommandHandlers

MIGChat.CommandHandlers

Command handlers for chat operations

Source:

Methods

(static) handleConnect(username)

Performs user connection with automatic disconnection of previous user

.

Performs user connection with automatic disconnection of previous user

Parameters:
Name Type Description
username Array.<string>

Array containing single username string

Source:
Example
// Connect new user
handleConnect(["newuser"]);

(static) handleJoin(room)

Joins existing room or creates new one if doesn't exist

.

Joins existing room or creates new one if doesn't exist

Parameters:
Name Type Description
room Array.<string>

Array containing single room name (e.g. ["#general"])

Source:
Example
// Join existing room
handleJoin(["#general"]);

// Create new room
handleJoin(["#newroom"]);

(static) handleLeave(args)

Leaves specified room or current room if not specified

.

Leaves specified room or current room if not specified

Parameters:
Name Type Description
args Array.<string>

Empty array or array with room name

Source:
Example
// Leave current room
handleLeave([]);

// Leave specific room
handleLeave(["#general"]);

(static) handleQuit()

Initiates graceful disconnection from server

.

Initiates graceful disconnection from server

Source:
Example
// Disconnect current user
handleQuit();

(static) handleRooms()

Requests list of rooms the user has joined

.

Requests list of rooms the user has joined

Source:
Example
// Get rooms list
handleRooms();

(static) handleSend(message)

Sends message to current room with validation

.

Sends message to current room with validation

Parameters:
Name Type Description
message string

Message text to send

Source:
Throws:

When not connected or no room joined

Type
Error
Example
// Send regular message
handleSend("Hello everyone!");