Modules/bIRC/ircSetQuitMessage

From Multi Theft Auto: Wiki
Revision as of 09:37, 30 July 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function is used to change the quit message of the specified {{ml_birc|ircbot}}. ==Syntax== <syntaxhighlight lang="lua"> bool ircSetQuitMessage ( ircbot theBot, str…')
(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 is used to change the quit message of the specified ircbot.

Syntax

bool ircSetQuitMessage ( ircbot theBot, string quitMessage )

Required Arguments

  • theBot: The ircbot which name you want to change
  • quitMessage: The new quit message for the ircbot

Returns

Returns true passed arguments were valid and quit message was changed, false otherwise.

Example

This example creates an ircbot called DummyBot and makes it connect to a server and join a channel once it has connected. It also includes an IRC command '!setquitmessage <name>' which can be used to change ircbot's quit message.

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

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

function event_ircOnText ( theBot, channel, sender, message )
    if message:find( "!setquitmessage" ) then
        local params = split ( message, string.byte (' ') )
        -- params[1] has the string "!setquitmessage" which we don't need
        -- params[2] has the new name
        ircSetQuitMessage ( theBot, params[2] )
    end
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other