Modules/IRCEcho/ircOpen: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ Opens a connection to the specified IRC Server ==Syntax== <syntaxhighlight lang="lua"> handler ircOpen ( string hostname, int port, string nick, string channel, [ string password = ""] ) </cod...) |
(→Syntax) |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
IRCConnection ircOpen ( string hostname, int port, string nick, string channel, [ string password = ""] ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required arguments=== | ===Required arguments=== |
Revision as of 14:37, 13 January 2008
Opens a connection to the specified IRC Server
Syntax
IRCConnection ircOpen ( string hostname, int port, string nick, string channel, [ string password = ""] )
Required arguments
- hostname: The IRC server to connect to
- port: The IRC server port
- nick: The nickname you want your bot to connect as
- channel: The channel you want the bot to join on connect
Optional arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- password: The password to enter the IRC server
Returns
Returns a pointer to the IRC connection if successful, otherwise it returns nil
Example
Example 1: This example connects to irc.gtanet.com on port 6667 as WikiTest and joins #Channel
szChans = {} --Init an array of channels for storage function onResourceStart( res ) if res == getThisResource() then -- If the starting resource is this one ircInit( ) -- Initialize the module for this resource pIRC = ircOpen( "irc.gtanet.com", 6667, "WikiTest", "#channel" ) -- Open the IRC connection if pIRC then -- If opening connection was successful szChans[ pIRC ] = "#channel" -- Add the channel to the table end end end addEventHandler( "onResourceStart", getRootElement(), onResourceStart )