Modules/bIRC/ircGetBotByName

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 returns the first ircbot pointer of the bot with the specified name. It's useful if you don't have access to the variable where bot was originally stored in ircCreateBot.

Syntax

ircbot ircGetBotByName ( string botName )

Required Arguments

  • botName: The name of the ircbot you want to get.

Returns

Returns the ircbot pointer if ircbot with specified name was found, false otherwise.

Example

This example adds a command getbotstate which can be used to check the current state of an ircbot.

function getIrcBotState ( thePlayer, commandName, botName )
    local theBot = ircGetBotByName ( botName )
    if theBot then
        outputChatBox ( botName .. " is currently " .. ircGetBotState ( theBot ) .. "." )
    else
        outputChatBox ( "There's no ircbot called " .. botName .. "!" )
    end
end
addCommandHandler ( "getbotstate", getIrcBotState )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other