1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
# This is a script that tests the different functions available. To run it,
# rename the filename so that it ends with '.pl'.
$botname = "FuncTestBot";
sub main()
{
odch::register_script_name($botname);
}
sub data_arrival()
{
my($user, $data) = @_;
if($data =~ /\$To: $botname/)
{
if($data =~ /mynick/)
{
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your nick is $user.|");
}
if($data =~ /mytype/)
{
my($type) = odch::get_type($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your type is $type.|");
}
if($data =~ /myip/)
{
my($ip) = odch::get_ip($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your ip is $ip.|");
}
if($data =~ /myhost/)
{
my($host) = odch::get_hostname($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your host is $host.|");
}
if($data =~ /myversion/)
{
my($version) = odch::get_version($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your version is $version.|");
}
if($data =~ /mydesc/)
{
my($desc) = odch::get_description($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your description is $desc.|");
}
if($data =~ /myconn/)
{
my($conn) = odch::get_connection($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your conn is $conn.|");
}
if($data =~ /myflag/)
{
my($flag) = odch::get_flag($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your flag is $flag.|");
}
if($data =~ /myshare/)
{
my($share) = odch::get_share($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your share is $share.|");
}
if($data =~ /myban/)
{
my($ban) = odch::check_if_banned($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your ban is $ban.|");
}
if($data =~ /myallow/)
{
my($allow) = odch::check_if_allowed($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your allow is $allow.|");
}
if($data =~ /kickme/)
{
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Kicking you...|");
odch::kick_user($user);
}
if($data =~ /moveme/)
{
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Moving you.|");
odch::force_move_user($user, "www.disney.com");
}
if($data =~ /getfork/)
{
my($fork) = odch::get_variable("users_per_fork");
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Users_per_fork is $fork.|");
}
if($data =~ /setfork/)
{
odch::set_variable("users_per_fork", "6");
}
if($data =~ /addban/)
{
odch::add_ban_entry("blahaj");
}
if($data =~ /removeban/)
{
odch::remove_ban_entry("blahaj");
}
if($data =~ /addreg/)
{
odch::add_reg_user("bobo", "bobo", 1);
}
if($data =~ /removereg/)
{
odch::remove_reg_user("bobo");
}
if($data =~ /countusers/)
{
my($count) = odch::count_users();
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> User count is $count.|");
}
if($data =~ /getshare/)
{
my($share) = odch::get_variable("total_share");
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Total share is $share.|");
}
if($data =~ /myreg/)
{
my($isregged) = odch::check_if_registered($user);
odch::data_to_user($user,
"\$To: $user From: $botname \$<$botname> Your reg status is $isregged.|");
}
}
}
|