Modules/bIRC/ircJoinChannel

From Multi Theft Auto: Wiki
Jump to: navigation, search

Package-x-generic.png This function is provided by the external module Basic IRC Module. You must install this module to use this function.

This function can be used to join a channel. Note that a delay of 2-3 seconds should be used before calling this function inside callback event_ircOnJoinChannel.

Syntax

bool ircJoinChannel ( ircbot theBot, string channel, [ string key = "" ] )

Required Arguments

  • theBot: The ircbot which is going to join the channel
  • channel: The channel which the ircbot will connect to

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • key: The key (password) for the channel. Needs to be specified for channels which have key set

Returns

Returns true if passed arguments were valid, false otherwise.
Note: Does not return true if ircbot successfully joined or false if the bot failed to join the channel. You can check if the bot joined the channel by using callback event_ircOnJoinChannel.

Example

This example creates an ircbot called DummyBot makes it connect to a server and join a channel called #testchannel after it has connected.

function resourceStart ( )
    theBot = ircCreateBot ( "DummyBot" )
    ircConnect ( theBot, "irc.gtanet.com", 6667 )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart )

function event_ircOnConnect ( theBot )
    setTimer ( ircJoinChannel, 2000, 1, theBot, "#testchannel" )
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other