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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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.
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.
my bad, sorry!
i don't have up to date documentation.
-
dovka
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 :)
at PEAR you can find the lastest docs:
http://pear.php.net/package/Net_SmartIRC/docs/latest/
thanks, meebs.
here is the discription of the isJoined method:
http://pear.php.net/package/Net_SmartIRC/docs/latest/Net_SmartIRC/Net_SmartIRC_base.html#methodisJoined