Menu

If bot is in channel

Help
2005-05-30
2013-04-09
  • Nobody/Anonymous

    I just want a IF statement that returens true if the bot is in channel x..

    i have try many things but cant seem to crack it, can some1 plz help me.

    thx
    mithc

     
    • dovka

      dovka - 2005-05-30

      if(in_array($irc->_nick, $irc->channel['#channel']->users))
      {
           // bot is in channel #channel
      }
      else
      {
           // bot is not in the channel
      }

      that should do it.
      if not try removing the hash off the start of the channel, i can't remember if the array keys for the channels have the hash or not. hope that helps.

       
      • Mirco Bauer

        Mirco Bauer - 2005-05-30

        that is very bad code, please don't use it!
        it uses an private variable, bad. and uses the array directly of the channel which is error prone! because of lower/uppercase usage, the proper way would be:

            /**      * checks if we or the given user is joined to the specified channel and returns the result      * ChannelSyncing is required for this.      *      * @see setChannelSyncing      * @param string $channel      * @param string $nickname      * @return boolean      * @access public      */     function isJoined($channel, $nickname = null)     {

        just use $irc->isJoined("#channel");
        it will handle casing right and no usage of internal variables.

         
        • dovka

          dovka - 2005-05-30

          my bad, sorry!
          i don't have up to date documentation.

          -
          dovka

           
    • Nobody/Anonymous

      thx, is there just a manual of commands, caz i just started programing this stuff yesterday, and i know php, but i got no idea of all the smartirc commands, id just like a list of commands and what they do, is there such a thing :)

       
      • Mirco Bauer

        Mirco Bauer - 2005-05-31

        at PEAR you can find the lastest docs:
        http://pear.php.net/package/Net_SmartIRC/docs/latest/

         
        • dovka

          dovka - 2005-05-31

          thanks, meebs.

           
      • Mirco Bauer

        Mirco Bauer - 2005-05-31
         

Log in to post a comment.