User Control Panel
Advertisements

HELP US, HELP YOU!

Getting bot to respond

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
Ack
Newbie
Newbie


Joined: 24 May 2006
Posts: 2


PostPosted: Wed May 24, 2006 11:15 pm    Post subject: Getting bot to respond Reply with quote

I got my bot to login to aim, but how would i get it to respond to certain phrases. Like is i said hi, how would i get it to say hello? Would i use an if statement?
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu May 25, 2006 1:57 am    Post subject: Reply with quote

You could use an if statement, or you could use a module that's specifically made for bot reply sets.

There are a few available on this forum, namely Trigger, Blab, and Banter, and there are some on CPAN.

Here's the two I know of on CPAN:

RiveScript - http://search.span.org/perldoc?RiveScript
This module's a good one for writing responses for your bot, it's a kind of "scripting" language, the source of a RiveScript file can look as simple as this, for your example:
Code:
+ hi
- hello

(+ is human input, - is the bot's reply)

There's a RiveScript forum here on Bot-Depot too. I posted an example of a full bot brain I wrote in RiveScript with lots of replies already. It's under the "RiveScript 0.21" topic. So check that out too.

Chatbot::Eliza - http://search.cpan.org/perldoc?Chatbot::Eliza
This module is the implementation of the classic Eliza therapist bot. It's not very flexible for having custom replies, but it sure pretends to know what you're talking about and acts like it can understand ya. Smile

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Ack
Newbie
Newbie


Joined: 24 May 2006
Posts: 2


PostPosted: Thu May 25, 2006 2:48 am    Post subject: Reply with quote

So how would i implement a module or RiveScript into my bot. All my does right now is login. Would i put the statements into the im_in sub?
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu May 25, 2006 11:43 am    Post subject: Reply with quote

You'd probably create a RiveScript object somewhere before any on_im's are called (probably in your main script, before Net::OSCAR even connects to AIM).

Code:
# Create a global RiveScript object
our $RiveScript = new RiveScript();

# Load replies
$RiveScript->loadDirectory ("./replies");
$RiveScript->sortReplies;

# ... connect to aim ...
our $oscar = new Net::OSCAR (...);


And in your on_im event:

Code:
my $reply = $RiveScript->reply ($screenname, $message, scalar => 1);

where $screenname and $message are the user's s/n and message as gotten in the handler.

(see the manpage for RiveScript about what scalar=>1 in the reply() method does; you may want to omit it to have RiveScript return an array)

Then you'd send_im the $reply back. Smile

(if you're not sure how to install modules, a lil trick for pure-Perl modules is to extract the distribution (zip file) somewhere, then copy what's inside its "lib" folder to your Perl/site/lib folder)

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Craig
Newbie
Newbie


Joined: 02 Sep 2006
Posts: 13

Reputation: -53.3
votes: 2

PostPosted: Sat Sep 02, 2006 7:39 am    Post subject: Reply with quote

how would you inplant this into perl, and use it in perl code?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group