#!/usr/bin/perl # by Alberto Simões (albie@alfarrabio.di.uminho.pt) package Dict; use cybot; use Net::Dict; $dict = Net::Dict->new('natura.di.uminho.pt'); register_command("dict", sub { my ($bot,$chan,$nick,$mask, @commands) = @_; my $word = $commands[0]; my $h = $dict->define($word); if (@$h) { foreach my $i (@{$h}) { my ($db,$def) = @{$i}; $db = "unkown" if $db=~/^\s*$/; $def =~ s/\n/ /g; $def =~ s/\s\s+/ /g; if (length($def)>430) { $def = substr $def,0,430; $def.="..."; } $bot->message ($chan, "$word\@$db:"); $bot->message ($chan, " $def"); } } else { $bot->message($chan, "Don't know! Beat me!"); } }, "Searches word on dictionaries\@natura.di.uminho.pt"); 1;