Modules/bIRC/ircGetBotByName

From Multi Theft Auto: Wiki

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