irc(n)
β¨ irc(n) β Low Level Tcl IRC Interface β¨
okay bestie, sit down, we're learning the low-level Tcl IRC interface π this is the manual page for irc(n), and yes it's giving β¨networkingβ¨ but in a cute way I promise.
πΈ NAME πΈ
irc β make an IRC connection and an interface to go with it. That's the whole vibe. π
π SYNOPSIS π
package require Tcl 8.6 9
package require irc ?0.8.0?
::irc::config ?key? ?value?
::irc::connection
::irc::connections
net registerevent event script
net getevent event script
net eventexists event script
net connect hostname ?port?
net config ?key? ?value?
net log level message
net logname
net connected
net sockname
net peername
net socket
net user username localhostname localdomainname userinfo
net nick nick
net ping target
net serverping
net join channel ?key?
net part channel ?message?
net quit ?message?
net privmsg target message
net notice target message
net ctcp target message
net kick channel target ?message?
net mode target args
net topic channel message
net invite channel target
net send text
net destroy
who ?address?
action
target
additional
header
msg
π¦ DESCRIPTION π¦
So like, what IS this β this package hands you the low-level commands for dealing with the IRC protocol (Internet Relay Chat) so you can do immediate and interactive multi-cast communication. Basically: group chat, but you're building the plumbing yourself. Main character energy fr. π
::irc::config?key? ?value? β sets the config ?key? to ?value?. The config keys that exist right now are the boolean flagsloggeranddebug.loggermakes irc use the logger package for printing error.debugneeds logger and prints extra debug output. If you don't hand it a ?key? or ?value?, it returns the current values. π«Ά::irc::connectionβ creates a brand new object to deal with an IRC connection. Important bestie: creating this IRC object does not automatically create the network connection. It returns a new irc namespace command that you use to interact with your new IRC connection. > β οΈ NOTE: the old form of the connection command β the one that took a hostname and port as arguments β is deprecated. Useconnectinstead to specify that info. no cap.::irc::connectionsβ returns a list of all the current connections that were created withconnection. it's giving roster. π
π PER-CONNECTION COMMANDS π
In this next list of available connection methods, net represents a connection command as returned by ::irc::connection. β¨
net registereventevent script β registers a callback handler for that specific event. The events available are the ones described in RFC 1459http://www.rfc-editor.org/rfc/rfc1459.txt. On top of those, there are several other events defined too:defaultcmdadds a command that gets called if no other callback is present.EOFgets called if the connection signals an End of File condition. The eventsdefaultcmd,defaultnumeric,defaultevent, andEOFare required. The script runs in the connection namespace, which means it can take advantage of several commands (peep the Callback Commands section below) to help with parsing data. π₯net geteventevent script β returns the current handler for the event if one exists. If not, you get an empty string back. π€·net eventexistsevent script β returns a boolean value telling you whether that event handler exists or not. vibe check βnet connecthostname ?port? β this is what actually causes the socket to be established.::irc::connectioncreated the namespace and the commands to be used, but it did not actually open the socket. That happens here. > β οΈ NOTE: the older form of Β΄connect' did not require you to specify a hostname and port, because those were specified with 'connection'. That form is deprecated. πnet config?key? ?value? β same as::irc::configbut it sets and gets options for thenetconnection only. πnet loglevel message β if logger is turned on by config, this writes a log message at level. πnet lognameβ returns the name of the logger instance, if logger is turned on. π·οΈnet connectedβ returns a boolean value indicating if this connection is connected to a server. true/false era.net socknameβ returns a 3 element list consisting of the ip address, the hostname, and the port of the local end of the connection, if it's currently connected. πnet peernameβ returns a 3 element list consisting of the ip address, the hostname, and the port of the remote end of the connection, if it's currently connected. πnet socketβ returns the Tcl channel for the socket used by the connection. πnet userusername localhostname localdomainname userinfo β sends theUSERcommand to the server. username is the username you want to appear. localhostname is the host portion of your hostname, localdomainname is your domain name, and userinfo is a short description of who you are. fun fact: the 2nd and 3rd arguments are normally ignored by the IRC server. πnet nicknick β theNICKcommand. nick is the nickname you wish to use for that particular connection. πnet pingtarget β sends a CTCPPINGto target. πnet serverpingβ pings the server. π₯οΈnet joinchannel ?key? β channel is the IRC channel to join. IRC channels typically begin with a hashmark ("#") or an ampersand ("&"). #οΈβ£net partchannel ?message? β makes the client leave channel. Some networks may support the optional message argument. πnet quit?message? β tells the IRC server to close the current connection. If you don't specify a message, the package uses a generic default. πͺnet privmsgtarget message β sends message to target, which can be either a channel, or another user β in that case their nick is used. πnet noticetarget message β sends a notice with message message to target, which can be either a channel, or another user β in that case their nick is used. π’net ctcptarget message β sends a CTCP of type message to target. β¨net kickchannel target ?message? β kicks the user target from the channel channel, with a message. The message part can be left out. π₯Ύnet modetarget args β sets the mode args on the target target. target may be a channel, a channel user, or yourself. self-care mode setting.net topicchannel message β sets the topic on channel to message. Specifying an empty string will remove the topic. βοΈnet invitechannel target β invites target to join the channel channel. πnet sendtext β sends text to the IRC server. π€net destroyβ deletes the connection and its associated namespace and information. π rest in peace bestie
π CALLBACK COMMANDS π
These commands can be used inside callbacks π«Ά
who?address? β returns the nick of the user who performed a command. The optional keywordaddressmakes the command return the user in the format"username@address". πactionβ returns the action performed, likeKICK,PRIVMSG,MODE, etc... Normally not useful, because callbacks are bound to a particular event anyway. π€·βοΈtargetβ returns the target of a particular command, such as the channel or user to whom aPRIVMSGis sent. π―additionalβ returns a list of any additional arguments after the target. πheaderβ returns the entire event header (everything up to the:) as a proper list. πmsgβ returns the message portion of the command (the part after the:). π¬
π BUGS, IDEAS, FEEDBACK π
Real talk bestie: this document, and the package it describes, will undoubtedly contain bugs and other problems. π Please report those in the category irc of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. Also please report any ideas for enhancements you may have for either the package and/or the documentation. π«Ά
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Also note further that attachments are strongly preferred over inlined patches. You can make attachments by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. π
π SEE ALSO π
rfc 1459
π KEYWORDS π
chatirc
π·οΈ CATEGORY π·οΈ
Networking
and that's the whole page, bestie π this one came from tcllib, version 0.8.0, and it's the irc(n) page β go build something iconic with it πβ¨π¦πΈπ
π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms