L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 01:47:50 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > Helpful posts > Topic: Removing member req
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Removing member req  (Read 1599 times)
0 Members and 1 Guest are viewing this topic.
Ltes
Rookie
**
Offline Offline

Posts: 34



WWW
Removing member req
« on: April 30, 2005, 05:31:55 PM »

well than thanks once again to craized, i can give more insight into teh world of bebot :wink:

allright in conjunction with faction only mod curtusy again of craized lol, but the member command kind of dimishes this effect.  to remove this requirement, you're going to want to open your bot.php in the main directory.
Code:
function is_member($uname)
    {
      $result = $this -> db -> select("SELECT nickname FROM members WHERE id = " . $this -> aoc -> get_uid($uname));
      if (!empty($result))
        return 1;

$result = $this -> db -> select("SELECT id FROM guests WHERE id = " . $this -> aoc -> get_uid($uname));
      if (!empty($result))
        return 2;

      return false;
    }

change that to
Code:

function is_member($uname)
{
    return 1;
}


there, now the bot will accept all requests to join from the sides you specified

have fun...go use your bot...shoo
Logged


[size=18]Ltes
*RK2*[/size]
Malosar
Expert
*****
Offline Offline

Posts: 259


WWW
Re: Removing member req
« Reply #1 on: June 15, 2006, 07:54:08 PM »

I modified is_member allowing me to open and lock my raidbot to the public.

Code:
        function is_member($uname)
        {
                $locktest = $this -> db -> select("SELECT value FROM settings WHERE value = 'locked'");
                $result = $this -> db -> select("SELECT nickname FROM members WHERE id = " . $this -> aoc -> get_uid($uname));
                if (!empty($result))
                return 1;

                $result = $this -> db -> select("SELECT id FROM guests WHERE id = " . $this -> aoc -> get_uid($uname));
                if (!empty($result))
                return 2;

                if (empty($locktest))
                return 2;

                return false;
        }


And my lock.php module:

Code:
<?php

  $lock 
= new Lock($bot);


  
$commands["pgmsg"]["lock"] = &$lock;
  
$commands["pgmsg"]["open"] = &$lock;




  
/*
    The Class itself...
  */
  
class Lock
  
{
    var 
$bot;
    var 
$lockstat;



    
/*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    
function Lock (&$bot)
    {
      
$this -> bot = &$bot;
      
$this -> lock = array();
    }

    function 
pgmsg($name,$msg) {
      if(
$this -> bot -> admin -> in_group($name, "admin")) {
                if (
preg_match("/^" . $this -> bot -> commpre . "lock/i", $msg)) {
                        
$this -> bot -> db -> query("UPDATE settings SET value='locked' WHERE setting = 'lock'");
                        
$this -> bot -> send_pgroup("<botname> has been locked to members only");
                }
                if (
preg_match("/^" . $this -> bot -> commpre . "open/i", $msg)) {
                        
$this -> bot -> db -> query("UPDATE settings SET value='open' WHERE setting = 'lock'");
                        
$this -> bot -> send_pgroup("<botname> has been opened to the public");
                }
        }
        else
                
$this -> bot -> send_pgroup("You must be an admin to use this command.");
     }
  }
?>

Also modifed the inc_pgleave function in bot.php to check whether an admin is leaving the raidbot channel and it's still unlocked.

Code:
function inc_pgleave($args)
{
$locktest = $this -> db -> select("SELECT value FROM settings WHERE value = 'locked'");
$user = $this -> aoc -> get_uname($args[1]);
if(empty($locktest) && $this -> admin -> in_group($user,"admin")) {
$this -> send_tell($user,"The bot is currently unlocked and you are an admin, please make sure the bot is locked after use");
$this -> send_tell("superadminname","The admin $user has left the raidbot unlocked");
}
$this -> log("PGRP", "LEAVE", $user . " left privategroup.");

if (!empty($this -> commands["pgleave"]))
{
$keys = array_keys($this -> commands["pgleave"]);
foreach ($keys as $key)
$this -> commands["pgleave"][$key] -> pgleave($user);
}
}

Obviously you would change "superadminname" to whoever owns the bot, or even code it to send it to all superadmins.

There are better ways to go about it as I wrote it fairly quickly when I wanted to open my bot to the public.
« Last Edit: June 25, 2006, 08:54:45 AM by Malosar » Logged

Eternalist
General of The Syndicate
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > Helpful posts > Topic: Removing member req
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[November 21, 2008, 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 18
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 0
Guests: 24
Total: 24

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.237 seconds with 28 queries. (Pretty URLs adds 0.028s, 4q)
Loading...