|
# This code is provided as is - in other words do whatever you like with
it.
use Chatbot::Eliza;
use TrillianPlugin;
TrillianPlugin::DispatchEvent;
$mybot = new Chatbot::Eliza;
my $alias_id_bot;
my $boton = 0;
sub incoming_privateMessage
{
if ($boton eq 1)
{
my ($SELF,$medium,$cid,$sender,$body,$location)
= @_;
my ($self,undef,$window_id,$event_id,$text,undef)
= @_;
$mybot->transform($text);
my $output = $mybot->transform($text);
TrillianPlugin::SendMessage($medium,$cid,$sender, $output);
}
}
sub action_botswitch
{
if ($boton eq 0)
{
$boton = 1;
TrillianPlugin::OutputDebug("TriplBot
is now on");
}
else
{
$boton = 0;
TrillianPlugin::OutputDebug("TriplBot
is now off");
}
TrillianPlugin::TextAliasZap;
}
sub script_onLoad
{
my(undef,undef,$SELF,undef,$FILE,undef) = @_;
$alias_id_bofh =
TrillianPlugin::CreateTextAlias("/bot","action_botswitch" ,$SELF);
}
sub script_OnUnload
{
TrillianPlugin::OutputDebug("The
TriplBot script is being unloaded!");
TrillianPlugin::DeleteTextAlias($alias_id_bot);
} |