BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Age of Conan Archive => AoC 0.6 support => Topic started by: dragonjr on January 08, 2011, 02:14:21 am
-
in the php codeing there is this code
eed to revize so it just uses core
*/
function memberslist()
{
$blob = "";
$count = 0;
$result = $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " . MEMBER . " ORDER BY nickname ASC");
if (!empty($result))
{
$inside = "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
foreach ($result as $val)
{
$count++;
$inside .= "##blob_text##• " . $val[0];
if ($val[1] > 0)
{
$inside .= ", last seen at " . gmdate($this -> bot -> core("settings") -> get("Time", "FormatString"), $val[1]);
}
else
{
$inside .= ", never seen online";
}
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " . $val[0], "[Whois]")."\n";
}
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
}
return $count . " Guild Members:" . $blob;
}
/*
Need to revize so it just uses core
*/
function memberscount()
{
$blob = "";
$total = 0;
$buddies = count($this -> bot -> aoc -> buddies);
//Get a list of professions
$profession_list = "'".$this->bot->core('professions')->get_professions("', '")."'";
$counts = $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
WHERE user_level = " . MEMBER . " AND t2.class IN ($profession_list) GROUP BY class");
foreach ($this -> bot->core('professions')->get_profession_array() as $prof)
$count[$prof] = 0;
if (!(empty($counts)))
{
foreach ($counts as $profcount)
{
$count[$profcount[0]] += $profcount[1];
$total += $profcount[1];
}
}
$inside = "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
foreach ($count as $key => $value)
$inside .= "\n• ".$key." = ##blob_title##".$value."##end##";
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
return $total . " Guild Classes:" . $blob;
}
}
?>
now the question is how do i shut this part off with out deleteing it?
any help would be great
thanks
-
put /* at the front and */ at the end of the code snipet, that should make it a comment and will make it not being parsed as code.
-
ok thank you
-
/* function command_handler($name, $msg, $origin)
{
if (preg_match('/^ginfo/i', $msg, $info)) {
$words = trim(substr($msg, strlen('ginfo')));
if ($words == "members")
{
return $this -> memberslist();
} else if($words == "classes") {
return $this -> memberscount();
} else {
return $this -> info();
}
} else if(preg_match('/^grecruit/i', $msg, $info)) {
//return "Command under development";
$msg = $this -> recruit();
$channel = $this -> bot -> core("chat") -> lookup_group("Playfield");
return "Currently under development: ".$channel;
} else {
$this -> bot -> send_help($name);
}*/
}
is this what you mean to disable it i know its ina diffrent spot than what i showed before but i get errors now
if you want i can post the whole code if that would help better
-
Yes the whole code and maybe a better description regarding what bit you don't want to run would help.
-
Find the line with
return $this -> memberslist();
Comment that line out and insert
//return $this -> memberslist();
return false; // Disable public viewing of memberslist
Or you could rewrite the whole command_handler function to only respond to ginfo trigger.
function command_handler($name, $msg, $origin) {
if (preg_match('/^ginfo/i', $msg)) {
return $this -> info();
}
return false;
}
-
ok hear the whole code i just need to disable the member list because people keep clicking it and cuasing lots of lag
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);
class GuildInfo extends BaseActiveModule
{
function __construct(&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_command('all', 'ginfo', "ANONYMOUS");
$this -> bot -> core("colors") -> define_scheme("GI", "highlight", "yellow");
$this -> bot -> core("colors") -> define_scheme("GI", "normal", "white");
$this -> bot -> core("colors") -> define_scheme("GI", "info", "lightgreen");
$this -> bot -> core("colors") -> define_scheme("GI", "red", "red");
$this -> bot -> core("colors") -> define_scheme("GI", "blue", "blue");
$this -> help['description'] = 'Helps with guild recruitment.';
$this -> help['command']['ginfo']="Displays guild's info tab.";
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
}
function command_handler($name, $msg, $origin)
{
if (preg_match('/^ginfo/i', $msg, $info)) {
$words = trim(substr($msg, strlen('ginfo')));
if ($words == "members")
{
return $this -> memberslist();
} else if($words == "classes") {
return $this -> memberscount();
} else {
return $this -> info();
}
} else if(preg_match('/^grecruit/i', $msg, $info)) {
//return "Command under development";
$msg = $this -> recruit();
$channel = $this -> bot -> core("chat") -> lookup_group("Playfield");
return "Currently under development: ".$channel;
} else {
$this -> bot -> send_help($name);
}
}
/*
Guilds Info
*/
function info()
{
$txt.= "##GI_blue##_-Black Moon Rising-_##end##\n\n";
$txt.= "##purple##Leaders:##end##\n\n";
$online = $this -> bot -> core("online") -> get_online_state('Reklats');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Reklats Im interested in joining _-BMR-_'>Reklats</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('nerissa');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell nerissa Im interested in joining _-BMR-_'>nerissa</a>##end##\n\n";
$txt.= "##purple##Leaders Alts:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Tiloka');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Tiloka Im interested in joining _-BMR-_'>Tiloka - Reklats</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Zemlya');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Zemlya Im interested in joining _-BMR-_'>Zemlya - nerissa</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Nerizza');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Nerizza Im interested in joining _-BMR-_'>Nerizza - nerissa</a>##end##\n\n";
$txt.= "##purple##Officers:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('sininstyle');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell sininstyle Im interested in joining _-BMR-_'>sininstyle - dragonsins</a> - Officer/Bot Admin##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Melwrath');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Melwrath Im interested in joining _-BMR-_'>Melwrath</a> - Officer##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Jormlar');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Jormlar Im interested in joining _-BMR-_'>Jormlar - jormette</a> - Officer##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('thrognar');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell thrognar Im interested in joining _-BMR-_'>thrognar</a> - Officer##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://blackmoonrising.guildlaunch.com##end##\n\n";
$txt.= "##GI_red##City:##end## ##GI_highlight##Full Tier III City ##end##\n\n";
$txt.= "##GI_red##Recruitment:##end## ##yellow## we are looking for fun and mature people##end##\n\n";
$txt.= "##GI_red##Guild Info:##end##\n";
$txt.= "##GI_info##";
$txt.= "Mature Casual Guild - Looking for all classes and levels - and serious raiders, especially West Coast and Oceanic Players.Also Looking for Tier Three Raiders willing to put in the work of learning new strats and be part of a team.\n
We are currently raiding T1 T2 and T3, we also are doing 6 mans in the new zone. \n
If you would like more information that is not posted please come visit us at our web site. http://blackmoonrising.guildlaunch.com \n
Click on one of the names and it should send a tell to that person that you are looking for a invite. \n\n";
$txt.= "<a href='chatcmd:///tell dragonfire !ginfo members'>List of Members</a>\n";
$txt.= "<a href='chatcmd:///tell dragonfire !ginfo classes'>List of Classes</a>\n";
$txt.= "##end##";
return $this -> bot -> core("tools") -> make_blob("_-Black Moon Rising-_", $txt);
}
/*
Still working on this, for now just some random debugging stuff I was trying
*/
function recruit()
{
$blob = "Black Moon Rising is Recruiting!: '";
$blob.= $this -> info();
$blob.= " Playfield ID: ";
return $blob;
}
/*
Need to revize so it just uses core
*/
function memberslist()
{
$blob = "";
$count = 0;
$result = $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " . MEMBER . " ORDER BY nickname ASC");
if (!empty($result))
{
$inside = "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
foreach ($result as $val)
{
$count++;
$inside .= "##blob_text##&#8226; " . $val[0];
if ($val[1] > 0)
{
$inside .= ", last seen at " . gmdate($this -> bot -> core("settings") -> get("Time", "FormatString"), $val[1]);
}
else
{
$inside .= ", never seen online";
}
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " . $val[0], "[Whois]")."\n";
}
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
}
return $count . " Guild Members:" . $blob;*/
}
/*
Need to revize so it just uses core
*/
function memberscount()
{
$blob = "";
$total = 0;
$buddies = count($this -> bot -> aoc -> buddies);
//Get a list of professions
$profession_list = "'".$this->bot->core('professions')->get_professions("', '")."'";
$counts = $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
WHERE user_level = " . MEMBER . " AND t2.class IN ($profession_list) GROUP BY class");
foreach ($this -> bot->core('professions')->get_profession_array() as $prof)
$count[$prof] = 0;
if (!(empty($counts)))
{
foreach ($counts as $profcount)
{
$count[$profcount[0]] += $profcount[1];
$total += $profcount[1];
}
}
$inside = "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
foreach ($count as $key => $value)
$inside .= "\n&#8226; ".$key." = ##blob_title##".$value."##end##";
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
return $total . " Guild Classes:" . $blob;
}
}
?>
and thanks again for all the help
-
Try this... added comments in CAPS in case you ever want to enable it again..
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);
class GuildInfo extends BaseActiveModule
{
function __construct(&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_command('all', 'ginfo', "ANONYMOUS");
$this -> bot -> core("colors") -> define_scheme("GI", "highlight", "yellow");
$this -> bot -> core("colors") -> define_scheme("GI", "normal", "white");
$this -> bot -> core("colors") -> define_scheme("GI", "info", "lightgreen");
$this -> bot -> core("colors") -> define_scheme("GI", "red", "red");
$this -> bot -> core("colors") -> define_scheme("GI", "blue", "blue");
$this -> help['description'] = 'Helps with guild recruitment.';
$this -> help['command']['ginfo']="Displays guild's info tab.";
// NO NEED FOR HELP FOR SOMETHING WE ARE DISABLING
// $this -> help['command']['ginfo members']="Displays a list of members in the guild.";
// $this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
}
function command_handler($name, $msg, $origin)
{
if (preg_match('/^ginfo/i', $msg, $info)) {
// DISABLE THE MEMBERSLIST/COUNT
// $words = trim(substr($msg, strlen('ginfo')));
// if ($words == "members")
// {
// return $this -> memberslist();
// } else if($words == "classes") {
// return $this -> memberscount();
// } else {
return $this -> info();
// }
} else if(preg_match('/^grecruit/i', $msg, $info)) {
//return "Command under development";
$msg = $this -> recruit();
$channel = $this -> bot -> core("chat") -> lookup_group("Playfield");
return "Currently under development: ".$channel;
} else {
$this -> bot -> send_help($name);
}
}
/*
Guilds Info
*/
function info()
{
$txt.= "##GI_blue##_-Black Moon Rising-_##end##\n\n";
$txt.= "##purple##Leaders:##end##\n\n";
$online = $this -> bot -> core("online") -> get_online_state('Reklats');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Reklats Im interested in joining _-BMR-_'>Reklats</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('nerissa');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell nerissa Im interested in joining _-BMR-_'>nerissa</a>##end##\n\n";
$txt.= "##purple##Leaders Alts:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Tiloka');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Tiloka Im interested in joining _-BMR-_'>Tiloka - Reklats</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Zemlya');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Zemlya Im interested in joining _-BMR-_'>Zemlya - nerissa</a>##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Nerizza');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Nerizza Im interested in joining _-BMR-_'>Nerizza - nerissa</a>##end##\n\n";
$txt.= "##purple##Officers:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('sininstyle');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell sininstyle Im interested in joining _-BMR-_'>sininstyle - dragonsins</a> - Officer/Bot Admin##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Melwrath');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Melwrath Im interested in joining _-BMR-_'>Melwrath</a> - Officer##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Jormlar');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Jormlar Im interested in joining _-BMR-_'>Jormlar - jormette</a> - Officer##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('thrognar');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell thrognar Im interested in joining _-BMR-_'>thrognar</a> - Officer##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://blackmoonrising.guildlaunch.com##end##\n\n";
$txt.= "##GI_red##City:##end## ##GI_highlight##Full Tier III City ##end##\n\n";
$txt.= "##GI_red##Recruitment:##end## ##yellow## we are looking for fun and mature people##end##\n\n";
$txt.= "##GI_red##Guild Info:##end##\n";
$txt.= "##GI_info##";
$txt.= "Mature Casual Guild - Looking for all classes and levels - and serious raiders, especially West Coast and Oceanic Players.Also Looking for Tier Three Raiders willing to put in the work of learning new strats and be part of a team.\n
We are currently raiding T1 T2 and T3, we also are doing 6 mans in the new zone. \n
If you would like more information that is not posted please come visit us at our web site. http://blackmoonrising.guildlaunch.com \n
Click on one of the names and it should send a tell to that person that you are looking for a invite. \n\n";
// REMOVED THE LINES WHICH ADD LINKS AT THE BOTTOM
// $txt.= "<a href='chatcmd:///tell dragonfire !ginfo members'>List of Members</a>\n";
// $txt.= "<a href='chatcmd:///tell dragonfire !ginfo classes'>List of Classes</a>\n";
$txt.= "##end##";
return $this -> bot -> core("tools") -> make_blob("_-Black Moon Rising-_", $txt);
}
/*
Still working on this, for now just some random debugging stuff I was trying
*/
function recruit()
{
$blob = "Black Moon Rising is Recruiting!: '";
$blob.= $this -> info();
$blob.= " Playfield ID: ";
return $blob;
}
/*
Need to revize so it just uses core
*/
function memberslist()
{
$blob = "";
$count = 0;
$result = $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " . MEMBER . " ORDER BY nickname ASC");
if (!empty($result))
{
$inside = "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
foreach ($result as $val)
{
$count++;
$inside .= "##blob_text##&#38;#8226; " . $val[0];
if ($val[1] > 0)
{
$inside .= ", last seen at " . gmdate($this -> bot -> core("settings") -> get("Time", "FormatString"), $val[1]);
}
else
{
$inside .= ", never seen online";
}
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " . $val[0], "[Whois]")."\n";
}
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
}
return $count . " Guild Members:" . $blob;
}
/*
Need to revize so it just uses core
*/
function memberscount()
{
$blob = "";
$total = 0;
$buddies = count($this -> bot -> aoc -> buddies);
//Get a list of professions
$profession_list = "'".$this->bot->core('professions')->get_professions("', '")."'";
$counts = $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
WHERE user_level = " . MEMBER . " AND t2.class IN ($profession_list) GROUP BY class");
foreach ($this -> bot->core('professions')->get_profession_array() as $prof)
$count[$prof] = 0;
if (!(empty($counts)))
{
foreach ($counts as $profcount)
{
$count[$profcount[0]] += $profcount[1];
$total += $profcount[1];
}
}
$inside = "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
foreach ($count as $key => $value)
$inside .= "\n&#38;#8226; ".$key." = ##blob_title##".$value."##end##";
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
return $total . " Guild Classes:" . $blob;
}
}
?>
-
thanks again