From: <du...@us...> - 2004-03-15 08:53:06
|
Update of /cvsroot/tuxaator/tuxaator/Plugins/Dict In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15337 Modified Files: Plugin.pm Log Message: hmm Index: Plugin.pm =================================================================== RCS file: /cvsroot/tuxaator/tuxaator/Plugins/Dict/Plugin.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Plugin.pm 6 Jan 2004 22:05:44 -0000 1.12 --- Plugin.pm 15 Mar 2004 08:43:59 -0000 1.13 *************** *** 103,106 **** --- 103,111 ---- "level" => 2, }, + + "!random" => + { + "action" => "do_random", + }, ); *************** *** 612,615 **** --- 617,630 ---- }; + sub do_random + { + my ($self,@args) = @_; + my $event = pop @args; + my $sth = $self->{'core'}->{'dbh'}->prepare("SELECT term,story FROM terms ORDER BY RAND() LIMIT 1"); + $sth->execute(); + my $ref = $sth->fetchrow_hashref(); + $self->{'core'}->queue($event, sprintf("%s - %s",$ref->{'term'},$ref->{'story'})); + } + # retrieves a definition from the database sub _get_definition |