Modules/bIRC/ircIsConnected

From Multi Theft Auto: Wiki
Revision as of 20:13, 29 July 2009 by Awwu (talk | contribs) (→‎Example)
(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 check whether the specified ircbot is connected to a server.

Syntax

bool ircIsConnected ( ircbot theBot )

Required Arguments

  • theBot: The ircbot which connection state you want to check.

Returns

Returns true if the ircbot is connected, false otherwise.

Example

This example adds a command isbotconnected which can be used to determine if a certain bot is connected or not.

function checkIsBotConnected ( thePlayer, commandName, botName )
    local theBot = ircGetBotByName ( botName )
    if theBot then
        if ircIsConnected ( theBot )
            outputChatBox ( "Yes, " .. botName .. " is connected!", thePlayer )
        else
            outputChatBox ( "Nope, " .. botName .. " isn't connected!", thePlayer )
        end
    else
        outputChatBox ( "There is no bot called " .. botName .. "!", thePlayer )
    end
end
addCommandHandler ( "isbotconnected", checkIsBotConnected )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other