Translations of this page:
  • English (USA)

AIML2000-Interface

You can use your bot to interact with an external server with the AIML2000-Interface.

Someone interacts with your bot via Chat, Instant Message oder Group Message. With the AIML2000-Interface you can send this message to an external server. At first you have to set the AIML2000-Url pointing to your server (example!):

aiml2000 http://www.pikkubot.de/aiml2000.php?data=

Then you have to activate the aiml2000-Interface:

aiml 1

This is an easy example for your server-script (written in PHP):

<?php

// Logfile
//
$fd=fopen("/tmp/aiml2000.log", a);
fwrite($fd, base64_decode($_GET[data]));
fclose($fd);

// Get the field from the data-var
//
$exp=explode("\t", base64_decode($_GET[data]));

// $exp[0] -> CHAT / IM / GIM
// $exp[1] -> for GIM the Group-UUID
// $exp[2] -> Sender-UUID
// $exp[3] -> Sender-Name
// $exp[4] -> Message

// Result
//
if ($exp[0]=="CHAT")
{
 echo "Thanks for chatting with me ".$exp[3];
 die;
}

if ($exp[0]=="IM")
{
 echo "Thanks for sending an IM to me ".$exp[3];
 die;
}

if ($exp[0]=="GIM")
{
 echo "Thanks for your request to this group, ".$exp[3];
 die;
}

echo "\n";
?>

The “data”-field ist base64-encoded and seperated with tabs (\t).

The answer from the server is written in the source-channel (Chat, Instant Message oder Group Message).

Please use an:

echo "\n";

if you are not giving any output from the server, because the bot-Thread can end then immediately.

You are also able to execute commands coming from the server. You have to enable it first with:

aiml2000commands 1

Then the server can send commands if they begin with [COMMAND], example:

[COMMAND]say hello world

You can send multiple commands to the bot with:

[COMMAND];say hello world;say foo;say bar
wiki/aiml2000-interface.txt · Last modified: 2011/05/31 11:31 by eves
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0