8
|
1 |
<?php
|
24
|
2 |
$doctor = array();
|
|
3 |
|
8
|
4 |
require('eliza.php');
|
|
5 |
|
|
6 |
eb_hook('event_channel_msg', 'doctor_listen($chan, $message);');
|
|
7 |
eb_hook('snippet_dynamic', 'if ( $snippet === "doctor" ) return doctor_go($chan, $message, $snippet);');
|
|
8 |
eb_hook('event_greeting', 'doctor_greet($append);');
|
|
9 |
|
|
10 |
function doctor_go(&$chan, &$message, &$snippet)
|
|
11 |
{
|
|
12 |
global $doctor;
|
|
13 |
|
|
14 |
if ( $snippet == 'doctor' )
|
|
15 |
{
|
|
16 |
if ( isset($doctor[$message['nick']]) )
|
|
17 |
{
|
|
18 |
unset($doctor[$message['nick']]);
|
|
19 |
$chan->msg(eb_censor_words("{$message['nick']}, thank you for visiting the psychotherapist. Come again soon!"), true);
|
|
20 |
}
|
|
21 |
else
|
|
22 |
{
|
|
23 |
$doctor[$message['nick']] = new Psychotherapist();
|
|
24 |
$chan->msg(eb_censor_words("{$message['nick']}, I am the psychotherapist. Please explain your problems to me. When you are finished talking with me, type !doctor again."), true);
|
|
25 |
}
|
|
26 |
return true;
|
|
27 |
}
|
|
28 |
}
|
|
29 |
|
|
30 |
function doctor_listen(&$chan, &$message)
|
|
31 |
{
|
|
32 |
global $doctor;
|
|
33 |
|
|
34 |
if ( isset($doctor[$message['nick']]) && $message['message'] != '!doctor' )
|
|
35 |
{
|
|
36 |
$chan->msg(eb_censor_words($doctor[$message['nick']]->listen($message['message'])));
|
|
37 |
}
|
|
38 |
}
|
|
39 |
|
|
40 |
function doctor_greet(&$append)
|
|
41 |
{
|
|
42 |
$append .= ' Type !doctor for the psychotherapist.';
|
|
43 |
}
|