how to check if a nick is opped in irc

Back to PHP-IRC Support

Page: 1  
From User Message Body
AmigaSpide
Post #509
Member
Date: 7:02 pm, Apr 20 2007
Posts: 18


i`m trying to limit access to certain functions for the bot to ops only but i`m stuck :)

if (!$this->ircClass->isMode($line['fromNick'], "#channel", "o")){
return FALSE;
}

could anyone help me please :S



Manick
Post #510
user avatar
Admin
Date: 9:56 pm, Apr 20 2007
Posts: 223


you might check out hasModeSet. If you look in the command_reference.txt there are explanations of all inputs to every function (near the bottom).

--Manick
PHP-IRC Developer
AmigaSpide
Post #511
Member
Date: 2:52 am, Apr 24 2007
Posts: 18


thank you i did but i cannot work it out :/

Mad_Clog
Post #512
user avatar
Member
Date: 7:37 am, Apr 24 2007
Posts: 176


Code
----------------------------------
bool    hasModeSet($chan, $nick, $modes)
----------------------------------

If any of the modes specified in "$modes" are set on a user in a channel, this will return true.
For instance:

If Manick is +vo in channel #manekian,

hasModeSet("#manekian", "Manick", "oh")

will return true.  I'm asking php-irc if Manick is either mode o or mode h.  Which he's mode o, so it returns true.


Code
if($this->ircClass->hasModeSet('#somechan', 'somenick', 'o')
{
  // has ops
} else {
  // no ops
}


AmigaSpide
Post #514
Member
Date: 1:19 pm, Apr 27 2007
Posts: 18


yep thx but i was hoping i could use it to check if any user was opped and if so they could use certain commands and if not they would get a notice to say so

Mad_Clog
Post #515 - Reply to (#514) by AmigaSpide
user avatar
Member
Date: 9:20 am, May 1 2007
Posts: 176


replace 'somenick' with $line['fromNick']

   

Back to PHP-IRC Support