This shows you the differences between the selected revision and the current version of the page.
wiki:aiml2000-interface 2011/05/31 10:54 | wiki:aiml2000-interface 2011/05/31 11:31 current | ||
---|---|---|---|
Line 15: | Line 15: | ||
<code> | <code> | ||
<?php | <?php | ||
+ | |||
+ | // Logfile | ||
+ | // | ||
$fd=fopen("/tmp/aiml2000.log", a); | $fd=fopen("/tmp/aiml2000.log", a); | ||
fwrite($fd, base64_decode($_GET[data])); | fwrite($fd, base64_decode($_GET[data])); | ||
fclose($fd); | fclose($fd); | ||
+ | // Get the field from the data-var | ||
+ | // | ||
$exp=explode("\t", base64_decode($_GET[data])); | $exp=explode("\t", base64_decode($_GET[data])); | ||
Line 26: | Line 31: | ||
// $exp[3] -> Sender-Name | // $exp[3] -> Sender-Name | ||
// $exp[4] -> Message | // $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"; | ||
?> | ?> | ||
</code> | </code> | ||
+ | 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: | ||
+ | <code> | ||
+ | echo "\n"; | ||
+ | </code> | ||
+ | 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: | ||
+ | <code> | ||
+ | aiml2000commands 1 | ||
+ | </code> | ||
+ | |||
+ | Then the server can send commands if they begin with [COMMAND], example: | ||
+ | <code> | ||
+ | [COMMAND]say hello world | ||
+ | </code> | ||
+ | You can send multiple commands to the bot with: | ||
+ | <code> | ||
+ | [COMMAND];say hello world;say foo;say bar | ||
+ | </code> | ||
+ |