Modules/bIRC/ircGetConnectedChannels

From Multi Theft Auto: Wiki
Jump to: navigation, 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 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