Modules/bIRC/ircGetConnectedChannels

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 can be used to list out all the channels a specified ircbot has connected to.

Syntax

table ircGetConnectedChannels ( ircbot theBot )

Required Arguments

  • theBot: The ircbot which connected channels you want to get

Returns

Returns a table over all connected channels. Returns an empty table if the ircbot isn't connected to any channel.

Example

This example adds a command listchannels which can be used to print out all channels where the specified ircbot is connected to the console.

function printOutChannels ( thePlayer, commandName, name )
    local theBot = ircGetBotByName ( name )
    if not theBot then
        outputConsole ( "There's no ircbot called " .. name .. "!", thePlayer )
    else
        local channels = ircGetConnectedChannels ( theBot )
        outputConsole ( name .. " is on " .. #channels .. " channels:", thePlayer ) 
        for key, value in ipairs ( channels ) do
            outputConsole ( "- " .. value, thePlayer )
        end
    end
end
addCommandHandler ( "listchannels", printOutChannels )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other