Posted: Sun Jul 10, 2005 12:37 am Post subject: Leviathan: Origin and Meaning of First Name
Command Name: !name
Description: Origin and Meaning of First Name
Usage: !name <first name>
Example:
Quote:
Kirsle: !name Noah
RiveCKS: Origin and Meaning of First Name Noah
What is the ethnic origin?
Biblical
What does it mean?
That quavers or totters (Zelophehad's daughter).
What's the gender (commonly)?
Female
Quote:
Kirsle: !name Kirsle
RiveCKS: Sorry, no matches were found for that name.
The Code:
Code:
# . . <Leviathan>
# .:...:: Command Name // !name
# .:: ::. Description // Origin and meaning of first name.
# ..:;;. ' .;;:.. Usage // !name <first name>
# . ''' . Permissions // Public.
# :;,:,;: Listener // All
# : : Copyright // 2005 AiChaos Inc.
sub name {
my ($self,$client,$msg) = @_;
# Command created by Cerone Kirsle, (C) 2005. Leave this copyright
# completely intact if you port this command to a different
# template. Thanks!
# See if there's a name to check.
if (length $msg > 0) {
$msg = lc($msg);
$msg =~ s/ //g;
# Get the name site.
my $src = LWP::Simple::get "http://www.weddingvendors.com/baby-names/meaning/$msg/";
$src =~ s/\n//g;
# No matches?
if ($src =~ /Sorry\, no matches were found/) {
return "Sorry, no matches were found for that name.";
}
my ($name,$origin,$mean,$gender) = ($msg,'undefined','undefined','undefined');
# Data patterns.
my %pattern = (
name => '<h1>Origin and Meaning of First Name (.*?)<\/h1>',
origin => '<h2 class=\"question\">What is the ethnic origin\?<\/h2><p>(.*?)<\/p>',
mean => '<h2 class=\"question\">What does it mean\?<\/h2><p>(.*?)<\/p>',
gender => '<h2 class=\"question\">What\'s the gender \(commonly\)\?<\/h2><p>(.*?)<\/p>',
);
# Get the data.
if ($src =~ /$pattern{name}/) {
$name = $1;
}
if ($src =~ /$pattern{origin}/) {
$origin = $1;
}
if ($src =~ /$pattern{mean}/) {
$mean = $1;
}
if ($src =~ /$pattern{gender}/) {
$gender = $1;
}
# Return it.
return "Origin and Meaning of First Name $name\n\n"
. "<b>What is the ethnic origin?</b>\n"
. " $origin\n"
. "<b>What does it mean?</b>\n"
. " $mean\n"
. "<b>What's the gender (commonly)?</b>\n"
. " $gender";
}
else {
return "Give me a first name to check, i.e.\n\n"
. "!name Michael";
}
}
{
Category => 'Fun Stuff',
Description => 'Origin and meaning of first name.',
Usage => '!name <first name>',
Listener => 'All',
};
Nice command, although I'm not too sure about that example, seeing as Noah is mainly male, as far as I know. _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Nice command, although I'm not too sure about that example, seeing as Noah is mainly male, as far as I know.
Quote:
Kirsle: !gender Noah
RiveCKS: It's a girl!
Based on popular usage, it is 2.083 times more likely for Noah to be a girl's name.
The popularity of Noah is: 3.809
(Where 0 = extremely rare and 6 = extremely common)
Apparently in some parts of the world (more parts than others) it's moe commonly a girl's name. _________________ Current Site (2008) http://www.cuvou.com/