Modules/bIRC/ircPartChannel

From Multi Theft Auto: Wiki
Revision as of 18:23, 13 August 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function can be used to part (leave) a channel. The specified {{ml_birc|ircbot}} has to be in the channel. ==Syntax== <syntaxhighlight lang="lua"> bool ircPartChann…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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 part (leave) a channel. The specified ircbot has to be in the channel.

Syntax

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

Required Arguments

  • theBot: The ircbot which is going to part the specified channel

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.

  • channel: The channel which the ircbot will part from. If not specified, parts the last joined channel

Returns

Returns true if passed arguments were valid, false otherwise.

Example

This example creates an ircbot called DummyBot makes it connect to a server and join a channel called #testchannel after it has connected. It also makes it part that channel after a little while.

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

function event_ircOnJoinChannel ( theBot, channel, name )
    if name == ircGetName ( theBot ) then -- if the user which connected was the ircbot
        setTimer ( ircPartChannel, 5000, 1, theBot, channel )
    end
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other