Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Mod channel descriptions

Frug edited this page Oct 11, 2012 · 1 revision

Add the following code to the end of js/custom.js and then reload your chat.

Of course, you can replace "Welcome to channel x" with whatever you want and you can add as many channels as you want by using the same format.
The channelIDs will depend on your installation. You can put html code in the channel messages.

//Override the handleInfoMessage function for welcome messages
ajaxChat.handleInfoMessage = function(infoType, infoData) {
	switch(infoType) {
		case 'channelSwitch':
			this.clearChatList();
			this.clearOnlineUsersList();
			this.setSelectedChannel(infoData);
			this.channelName = infoData;
			this.channelSwitch = true;
			break;
		case 'channelName':
			this.setSelectedChannel(infoData);
			this.channelName = infoData;
			break;
		case 'channelID':
			this.channelID = infoData;
			//Welcome message for channels goes here
			if (this.channelID == 0)
				this.addChatBotMessageToChatList('Welcome to channel 0. Please follow the rules.');
			if (this.channelID == 1)
				this.addChatBotMessageToChatList('Welcome to channel 1. Nobody follows the rules here!');
			//That's it.
			break;
		case 'userID':
			this.userID = infoData;
			break;
		case 'userName':
			this.userName = infoData;
			this.encodedUserName = this.scriptLinkEncode(this.userName);
			this.userNodeString = null;
			break;
		case 'userRole':
			this.userRole = infoData;
			break;
		case 'logout':
			this.handleLogout(infoData);
			return;
		case 'socketRegistrationID':
			this.socketRegistrationID = infoData;
			this.socketRegister();
		default:
			this.handleCustomInfoMessage(infoType, infoData);
	}
}