Modules/bIRC/ircGetBots

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 can be used to list out all created ircbots.

Syntax

table ircGetBots ()

Required Arguments

None

Returns

Returns a table over all created ircbots. Returns an empty table if no ircbots exist.

Example

This example adds a command listbots which can be used to print out all currently available ircbots along with their names to console.

function printOutIrcBots ( thePlayer )
    local ircBots = ircGetBots ()
    if #ircBots == 0 then
        outputConsole ( "There are no ircbots!", thePlayer )
    else
        outputConsole ( "There's " .. #ircBots .. " ircbots:", thePlayer ) 
        for key, value in ipairs ( ircBots ) do
            outputConsole ( "- " .. ircGetName ( value ), thePlayer )
        end
    end
end
addCommandHandler ( "listbots", printOutIrcBots )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other