Finding out the bot's status.

Back to PHP-IRC Bugs

Page: 1  
From User Message Body
Slarioux
Post #252
Member
Date: 10:11 pm, Jun 12 2006
Posts: 2


Heya,

For some reason I am unable to find out wether the bot has op, voice, or any other status. I'm just too lazy to remember what I tried exactly to retreive the data but I do remember having tried almost anything.

It's possible the network I'm connecting to is the cause (osiris.parse.nl) but maybe it's something known.

Something else which I might as well post here: Does the bot "cache" commando's in some way? Connected to the error above maybe (and thus the network I'm connecting to), I was unable to detect the status of a user untill the function finished.

To explain; I'm building a module which allows the !kick and !ban commando to be used by authorized user. Users are auth'd trough a database.

When I call the priv_kick() function (guess how I trigger it ;)), I cannot confirm the actuall banning (the function places a 30 second ban to prevent autorejoin) of the user untill the function has completely finished.

This problem rose when I was unable to check if my bot had the operator status; I wanted to somehow find out if the user was really banned, if my bot succeeded.

So you see, I am now stuck at the point where my bot just *bans* and *kicks* and happily reports it has succeeded. However, since the bot does not have a clue wether that's true, it looks a little silly.

To explain a little:
Code

function priv_kick() {
   banUser; // works
   userIsBanned(); // returns false;
   sleep(10); // maybe waiting helps?
   userIsBanned(); // still returns false;
}
function priv_iskicked() {
   userIsBanned; // returns true without blinking.
}


-edit-
For your viewing pleasure:
http://images.nder.be/jmbe/html

Last edited by Slarioux at 10:25 pm, Jun 12 2006

Manick
Post #253 - Reply to (#252) by Slarioux
user avatar
Admin
Date: 10:26 pm, Jun 12 2006
Posts: 223


To check if the bot has ops etc:

Code
if (!$this->ircClass->hasModeSet("#channel", $this->ircClass->getNick(), "oha"))
{
  return;
}

This code will see if the bot has +o, +h, or +a on #channel. If it doesn't, then it will return from the function.

The bot has a text queue which it maintains with the server in order to not get flooded off the server. Everything sent to privMsg() or sendRaw() or whatever is placed in the text queue. To bypass the text queue, and have things send directly to the server right away, you can use $this->ircClass->sendRaw("stuff here", true). This is useful for administration scripts like you want to do.

To see if someone was actually kicked, I recommend that you capture the irc 'KICK' message, by doing:

Code
kick my_mod my_function


in your function config file. Then you can capture who was kicked with $line['params'].

Hope some of this is helpful.


--Manick
PHP-IRC Developer
Slarioux
Post #254
Member
Date: 10:39 pm, Jun 12 2006
Posts: 2


Thx!

I totally didn't think of checking the channels content; that way I can also work around any problems I might have with banning and ops.

I already used raw() though, but it did not seem to work. I'll confirm it, but for now I'm good :).

   

Back to PHP-IRC Bugs