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

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

Author Topic: Help!! About Auto Invites  (Read 4957 times)

0 Members and 1 Guest are viewing this topic.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Help!! About Auto Invites
« on: September 02, 2005, 01:45:17 am »
Trying to get the auto invites to only invite people on the guest list and not the Members list and the answer is eluding me. Running Bebot as a guildbot.

First I noticed only the players ID number from FC is stored in the Guests table. That don't work so good as a reference for me.

I know the answer is in here:
Code: [Select]
function buddy($name, $msg)
    {
      if (($this -> auto == 1) && ($msg == 1) && ($this -> bot -> is_member($name) == 1))
            $this -> bot -> aoc -> privategroup_invite($name);
    }


I can not find a reference var to people on guest list to use.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Zacix

  • Contributor
  • *******
  • Posts: 73
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #1 on: September 02, 2005, 02:23:22 am »
change to:
Code: [Select]
function buddy($name, $msg)
    {
      if (($this -> auto == 1) && ($msg == 1) && ($this -> bot -> is_member($name) == 2))
            $this -> bot -> aoc -> privategroup_invite($name);
    }


a little late now, but think this should solve it.
Zacix
Current projects:
RINGBot, BeBot branch
Neutnet, RK2 Neutral massmessage network

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #2 on: November 18, 2005, 12:37:27 am »
Hi Xenixa,

Autoinviting guests would be useful for my bot - currently have a small org set up for a farm city using a guildbot setup.  How can the code above be incorporated into the guildbot?  It was a pain having it turned on as it is current setup as it was just inviting members to the guest chat all the time and not guests :)

Also, Is it possible to get the !massinv feature to work in Guild mode?  This would be useful if it could have a setting also to invite members and guests or just guests (using your script for guestlist too so not sure if this could pull info from there) :-)

Cheers,

-jj-

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #3 on: November 18, 2005, 02:05:55 pm »
Oooh geez... I forgot I had shoved this little trinket on the bottom of the pile, My org and guests have gotten so used to using !join for getting on the bots private channel I hadn't thought about it.

I did however track it down to the function that causes the autoinv function to only invite members and not guests. I just never did anything with it. It's in the core Bot file(bot.php) and it's name is function is_member().
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;
 }

Problem with that function at first glance is it's never given conditions on what to Return. Gunna poke at it with a stick for a little bit and see what comes out.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline krosis

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #4 on: November 20, 2005, 12:49:11 am »
I think the main problem you're running into here is the buddy function is called when someone signs onto the bot's friendlist.

Guests are not stored in that list, only members.

You could add people manually but then every roster update it would remove them again ><

I have a bot setup now in guild mode and used your updated Rooster_GUILD module except I noticed you do not have it add people to the bots friend list with your add_member function.

If you used your member function in that module (and make it add them to friend list) and disable the part that removes people from the roster you might get your desired effect.
Emphorix   /    Krosis   / Phoremix
   Death      /  Balance  /    Life

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #5 on: November 20, 2005, 09:24:42 am »
Naw the problem with auto invite on and it only inviting members is the is_member ($name) function always seems to return false for some reason.

Guests on the guests table are added to the bots buddy list via the Relay_GUILD.php. Problem is the way is_member is determining a guest from a member when called from autoinv.php or any other place its used.

If I'm reading the PHP docs correctly a User defined function using the Return command can only be one value. Normally the last value it was set to inside the function or to point it out the way I read it, it will always return False in the is_member function. But that doesn't tell me why Org Members get auto invited to the privatechannel when they login.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #6 on: November 20, 2005, 08:39:14 pm »
Ok now that I am more awake and have had some time to look at it, this is what I came up with.
Code: [Select]
    function is_member($uname)
    {
if ($uid = $this -> aoc -> get_uid($uname))
{
$result = $this -> db -> select("SELECT nickname FROM members WHERE id = " . $uid);
    if (!empty($result))
        return 1;
else
$result = $this -> db -> select("SELECT id FROM guests WHERE id = " . $uid);
      if (!empty($result))
      return 2;
else
      return false;
}
    }
Basically I gave it more conditional checking. Haven't tested this yet but it shouldn't break other modules that call is_member from the Bot.php

Oh and as per Zacix post above you would need to make his change he shows to autoinv.php ... basically changing the 1 to a 2 should in theory only auto invite guests using the is_member function I posted here.
« Last Edit: March 17, 2006, 01:07:14 am by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Help!! About Auto Invites
« Reply #7 on: November 20, 2005, 10:32:10 pm »
Hmm ok had a chance to test the above function change as written.
Problem: Even with autoinv on not even members or guests get an invite.... *scratch head*

It's doesn't seem to affect anything else though which is good. I'll fiddle with it more later.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Linachan

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #8 on: March 16, 2006, 09:30:39 pm »
it seems as if autoinv still invites members ... nobody working on this anymore?

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #9 on: March 16, 2006, 10:16:41 pm »
I just did this:

Code: [Select]
function buddy($name, $msg)
{
$result = $this -> bot -> db -> select("SELECT name FROM guests WHERE name = " . $name);
if (($this -> auto == 1) && ($msg == 1) && (!empty($result)))
$this -> bot -> aoc -> privategroup_invite($name);
}

Seems to be working just fine for me :)
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #10 on: March 17, 2006, 01:03:58 am »
I fixed this months ago. Only the changes and fixes were posted in a couple different threads.

Just to recap:
You will need fixes for the Autoinv.php and Relay_GUILD.php which you can find here:
ftp://xen.afraid.org/bebot_files/autoinv_modules.zip

Some notes on these files:
The Relay_GUILD.php uses Alreadythere's Whois cache module.
Autoinv.php uses the fixes to the is_member() function I posted earlier in this thread to work properly.
There are some changes(if you havn't done them yet) to the Guests table to get Autoinv.php to work correctly. Info on those changes are in Relay_GUILD.php
Also you'll want to add 2 functions to Bot.php if yours doesn't have them. (Autoinv.php uses them)
Place these just below the function disconnect()
Code: [Select]
   function get_setting($set)
    {
    $res = $this -> db -> select("SELECT * FROM settings WHERE setting = '" . $set . "'");
    if (!empty($res))
return $res[0][1];
    else
return "";
    }

    function set_setting($set, $value)
{
$this -> db -> query("UPDATE settings SET value = '" . $value . "' WHERE setting = '" . $set . "'");
}
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #11 on: March 30, 2006, 05:16:47 am »
Error Code : 1062
Duplicate entry 'auto_invite' for key 1
(0 ms taken)


got above error msg when i run the bot

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #12 on: March 30, 2006, 08:46:39 am »
Strange, the function AutoInv() I have in that version shouldn't allow that to happen.
Any other errors from the bot other than that? Did you make sure to add the function get_setting() to Bot.php? Only reason I can think it did that is that it couldn't find auto_invite in the settings table and tried to insert it again.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #13 on: March 31, 2006, 06:26:01 am »
Code: [Select]
/*
        Returns a selected setting:
        */
        function get_setting($set)
    {
    $res = $this -> db -> select("SELECT * FROM settings WHERE setting = '" . $set . "'");
    if (!empty($res))
return $res[0][1];
    else
return "";
    }

    function set_setting($set, $value)
{
$this -> db -> query("UPDATE settings SET value = '" . $value . "' WHERE setting = '" . $set . "'");
}

above is what i have in my bot.php
i also noticed that if i turn autoinv on and if bot reboot
it will get an error on line 53
i had to go in mysql server to change autoinvite value back to 0 and then it will give me the error code: 1062

also tested out the autoinv but it doesn't work on my bot for some reason :/

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Help!! About Auto Invites
« Reply #14 on: August 20, 2006, 12:10:55 pm »
Ok, added those 2 files that you have, put those entries in the bot.php, turned auto-invite on, and then turned notify on on the character I want auto-invited and nothing.  No errors in bot, the sql database is updating properly, but I just dont' get invited.  Any ideas?

 

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


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


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


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 598
  • 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