|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 name of the specified ircbot.
bool ircSetName ( ircbot theBot, string name )
- theBot: The ircbot which name you want to change
- name: The new name of the ircbot
Returns true passed arguments were valid, false otherwise.
Note: Does not return true if ircbot's name was successfully changed or false if the bot's name wasn't changed. You can check if the bot had it's name changed by using callback event_ircOnNickChange.
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 '!setname <name>' which can be used to change ircbot's name.
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( "!setname" ) then local params = split ( message, string.byte (' ') ) -- params has the string "!setname" which we don't need -- params has the new name ircSetName ( theBot, params ) end end