collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Removing member req  (Read 10636 times)

0 Members and 1 Guest are viewing this topic.

Offline Ltes

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
    • http://www.ltes.cjb.net/
Removing member req
« on: May 01, 2005, 12:31:55 am »
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: [Select]
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: [Select]

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


[size=18]Ltes

*RK2*[/size]

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: Removing member req
« Reply #1 on: June 16, 2006, 02:54:08 am »
I modified is_member allowing me to open and lock my raidbot to the public.

Code: [Select]
        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: [Select]
<?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: [Select]
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, 03:54:45 pm by Malosar »
Eternalist
General of The Syndicate

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 94
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal