Possible for multiple chat bots?

109 views
Skip to first unread message

Chris D

unread,
Jul 7, 2014, 4:29:43 AM7/7/14
to ajax...@googlegroups.com
Just curious on this since we've already developed ways to have the chat bot speak on our behalf. Was curious if it was possible to declare more than 1 and given them a name just for kicks, maybe later to perform additional functions to make the room seem more lively or advanced.

I know a lot of our people utilize the chatbot talk function to make it seem like the chatbot is a real person adn really ties in with the chat.

Chris D

unread,
Apr 14, 2015, 12:36:28 PM4/14/15
to ajax...@googlegroups.com
Or at least emulating another ( one that doesn't respond to echo system commands like the primary one does, and only shows up with special commands )

Stephen Gemme

unread,
Apr 15, 2015, 11:56:28 AM4/15/15
to ajax...@googlegroups.com
Possible? Yes. 
  • The Chatbot isn't a user (obviously), so you can't just make another one easily. 
  • Because of the above: for each Chatbot Declaration, you'll have to make a duplicate "Chatbot2" declaration. 
  • I'm sure I've left out some details here, but this should get you on the right path.
Config.php Example:
// The userID used for ChatBot messages:
$config
['chatBotID'] = 2147483647;
// The userName used for ChatBot messages
$config
['chatBotName'] = 'Skynet';


// The userID used for ChatBot2 messages:
$config
['chatBot2ID'] = 2147483648;
// The userName used for ChatBot2 messages
$config
['chatBot2Name'] = 'Skynet Part 2';

Config.JS Example:
 // The name of the chat bot:
 chatBotName
: 'Skynet',
 
// The userID of the chat bot:
 chatBotID
: 2147483647,


 
// The name of the chat bot:
 chatBot2Name
: 'Skynet Part 2',
 
// The userID of the chat bot:
 chatBot2ID
: 2147483648,


From here, you'll be able to manipulate how ChatBot2 functions and how it's called. 

AjaxChat.php
function insertChatBotMessage($channelID, $messageText, $ip=null, $mode=0) {
$this->insertCustomMessage(
$this->getConfig('chatBotID'),
$this->getConfig('chatBotName'),
AJAX_CHAT_CHATBOT,
$channelID,
$messageText,
$ip,
$mode
);
}

If you make a 2nd function that's for Chatbot2, you can make it be called from anywhere within the chat, exactly how the original chatbot is. What you do with it, and when it's called is up to you.

Don't forget to give it some identification within your chat though!

Uranium.css
#content .chatBot2 {
 color
:#4c9546;
}

Hope this helps! :)

 -Stephen

Chris D

unread,
Apr 15, 2015, 1:55:08 PM4/15/15
to ajax...@googlegroups.com
Wow thanks! For teh AjaxChat.php part where would you insert this, as I'm attempting to but it keeps breaking chat. Also is the "AJAX_CHAT_CHATBOT" something I should change?

Oddly after adding the above chat broke, I log in and no msgs populate. I backed out of the change and still not populating so may go ahead and reinstall chat.

However as for the AjaxChat.php if you could let me know where to add that in and if there's anything else I need to change I'd greatly appreciate it!

Stephen Gemme

unread,
Apr 15, 2015, 2:29:19 PM4/15/15
to ajax...@googlegroups.com
'AJAX_CHAT_CHATBOT' is merely specifying the class of the user so that the chat knows what scheme to use when they post, and what permissions that the account has, so this doesn't need to be changed. 

The Function I posted from AjaxChat.php is already present there, my suggestion is to duplicate this function but rename it and fix the Chatbot call to the ChatBot2 call. 

There will be some finagling with the code to make it work correctly, but just do it one step at a time.

If I can find time between buying a house, preparing for a wedding, and planning a huge organized auto-meet I'll try to whip something up in my test chat. 

Chris D

unread,
Apr 15, 2015, 11:18:49 PM4/15/15
to ajax...@googlegroups.com
Thanks, I figured out the rest and got it working, however only odd part is for spanning text if I wanna make chatbot2 do something, it oddly just sends it out as a normal text vs an action, while the first one still does even after adding the code. I'll troubleshoot more into it. HOwever thanks so much for your help.

The CSS part doesn't function, however I'm sure that requires something else in order to set it.
Reply all
Reply to author
Forward
0 new messages