IMified bot with ALICE
Hi,
I was wondering if my IMified bot could somehow be connected with A.L.I.C.E. My bot (***@bot.im) is currently available on gtalk, yahoo and msn, with it's endpoint being a HelloWorld Php script loaded onto a local server.
I wanted to alter that so that my bots could connect to the ALICE server and get responses from the ALICE bot there, directly onto these chat clients. Is it possible? If so, what endpoint should I specify?
Regards,
Gautam
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Adam Kalsey on 09 Dec, 2009 03:42 AM
If you install the PHP ALICE engine Program E from
http://sourceforge.net/projects/programe/files/ you can create an
ALICE bot by putting the following code in a file called imified.php,
putting it in the same directory as talk.php (part of Program E) and
pointing your app endpoint at that file.
<?php
include "respond.php";
$user = md5($_POST['user'] .'@'. $_POST['network']);
$botresponse=replybotname($_POST['msg'], $user, 'TestBot');
echo $botresponse->response;
?>
You can test a sample ALICE bot by adding ***@bot.im as a Jabber contact.
3 Posted by Gautam on 09 Dec, 2009 08:23 AM
Hi,
I followed the instructions above. I installed Program E and then placed a file called imified.php in the talk.php folder with the above code. However, when I chat with it, it returns me a long string of gibberish like what's given below (I have not pasted it all, just the start and the end):
"<?$gendersearch=array("/\bhe\b/ie","/\bshe\b/ie","/\bto him\b/ie","/\bfor him\b/ie","/\bwith him\b/ie","/\bon him\b/ie","/\bin him\b/ie","/\bto her\b/ie","/\bfor her\b/ie","/\bwith her\b/ie","/\bon her\b/ie","/\bin her\b/ie","/\bhis\b/ie","/\bher\b/ie","/\bhim\b/ie","/\ber\b/ie","/\bihm\b/ie","/\bsein\b/ie","/\bihn\b/ie",);$genderreplace=array("myfunc('she')","...............................................
Warning: preg_replace() [function.preg-replace]: Empty regular expression in D:\xampp\htdocs\programe\src\util.php on line 588
Try to determine if this is a person or a computer responding."
How do I get around this problem? Could it be a syntax error somewhere in the talk.php file? When I tried running the talk.php file, it returned me a "Parse error: unexpected$ on line 132" that I wasnt able to resolve. I thought that since I did not require the interface, I could proceed inspite of the error, but the above happened instead.
Please let me know how to solve this.
Regards,
Gautam
4 Posted by Dave on 28 Dec, 2009 02:05 AM
I wonder what your script above would look like if it worked to connect program E to Twitter? You wouldn't by any chance happen to have a simple code sample that serves to do that by any chance?
TIA,
Dave
5 Posted by Dave on 28 Dec, 2009 02:12 AM
Hey Adam,
I realize that may have been a redundant question, but the script above looks pretty elegant, and was hoping there was a way to accomplish this.
Best,
Dave
Support Staff 6 Posted by Adam Kalsey on 28 Dec, 2009 03:03 AM
Exactly the same. With IMified you use one API to connect to every
service. You might want to adjust the ALICE responses to ensure that
Twitter users get shorter responses.
--
Adam Kalsey
This mobile device has tiny keys. Please excuse any typos.
7 Posted by Dave Williams on 28 Dec, 2009 04:59 AM
Adam,
Thanks for the response.
As I'm not a programmer, just wondering if my impulse to modify the bolded
variables (below) would be the correct thing to do correct syntactically, or
am I mucking your script:
<?php
include "respond.php";
$user = md5($_POST['user'] .'@'. $_POST['*twitter*']);
$botresponse=replybotname($_POST['msg'], $user, '*Heidi*');
echo $botresponse->response;
?>
Best,
Dave
Support Staff 8 Posted by Adam Kalsey on 28 Dec, 2009 05:27 AM
You don't need to modify anything. Just add a Twitter account to your
bot. Don't use an account you use for other things, since the bot will
reply to any @ reply sent to the Twitter ID you attached.
--
Adam Kalsey
This mobile device has tiny keys. Please excuse any typos.
9 Posted by Dave Williams on 28 Dec, 2009 06:37 AM
Will give it a shot. Thanks :)
10 Posted by Dave Williams on 28 Dec, 2009 10:49 AM
Hey, got it working. Actually, did have to adjust it a little, but easy to
figure out once I got my hands dirty. Now, to train my bot against real
conversations :)
11 Posted by Gautam on 11 Jan, 2010 07:24 AM
Hi Adam,
I seem to have isolated the problematic line as being this one:
$user = md5($POST['user'] .'@'. $POST['network']);
As I posted above, a lot of gibberish (which I found was from the startup.xml file) gets printed as a response. I think the problem is with the above line, as it prints everything fine after that.
Is there any way I can modify the above command so that it works for me? I think because this command is not working for me, the user input does not get read in properly, which leads to:
Warning: preg_replace() [function.preg-replace]: Empty regular expression in D:\xampp\htdocs\programe\src\util.php on line 588
I have also tested the url for imified.php and it seems to work fine there (provided I comment out line 588 of util.php).
Do let me know how to solve this problem.
Thanks,
Gautam
Support Staff 12 Posted by Adam Kalsey on 11 Jan, 2010 09:37 PM
Your server is probably configured to only use `<?php` as an opening
tag, but the Program E code uses `<?` -- I'm afraid you're going to
have to check with the guys behind Program E to get things going.
If you're not able to use talk.php (what comes with Program E) then
the bot shim that I wrote for it won't work either.
13 Posted by Dave Williams on 11 Jan, 2010 09:46 PM
Hey Adam, I think this was meant for Gautam...
Support Staff 14 Posted by Adam Kalsey on 11 Jan, 2010 09:56 PM
Dave, replies to a thread go to all people who have posted in the thread.
If you don't want to continue getting updates on this thread, you can
click the Unsubscribe button on the thread's web page at
http://help.imified.com/discussions/questions/601-imified-bot-with-alice
15 Posted by Gautam on 21 Jan, 2010 04:39 AM
Porgram E seems to be working fine now :-) . Did a reinstall, and everything seems to be running!
16 Posted by mlucas on 15 Oct, 2010 05:19 PM
It looks like we've answered this for you, so we're going to mark this question as resolved. If you have any questions, you can re-open this issue or send a new one in and we'll be glad to help.
-Matt Lucas
IMified Support
mlucas closed this discussion on 15 Oct, 2010 05:19 PM.