{"id":22292614,"url":"https://github.com/ericnorris/irc-client","last_synced_at":"2025-03-25T21:47:03.107Z","repository":{"id":18614368,"uuid":"21819860","full_name":"ericnorris/irc-client","owner":"ericnorris","description":"A node.js IRC client.","archived":false,"fork":false,"pushed_at":"2016-01-25T04:17:01.000Z","size":39,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-01T10:36:58.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericnorris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-14T13:09:53.000Z","updated_at":"2020-07-20T19:24:02.000Z","dependencies_parsed_at":"2022-08-26T01:23:09.732Z","dependency_job_id":null,"html_url":"https://github.com/ericnorris/irc-client","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericnorris%2Firc-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericnorris%2Firc-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericnorris%2Firc-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericnorris%2Firc-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericnorris","download_url":"https://codeload.github.com/ericnorris/irc-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550540,"owners_count":20633872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T17:23:10.196Z","updated_at":"2025-03-25T21:47:03.079Z","avatar_url":"https://github.com/ericnorris.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yirc - yet another IRC client\nAnother offering to the god of IRC, for node.js.\n\n## Installation\n`npm install yirc`\n\n## Example\n```javascript\nvar yirc = require('yirc');\nvar bot = new yirc({hostname: 'yourserver', port: 6667, nick: 'yournick'});\nbot.on('register', function() {\n    bot.join('#yourchannel', function(err, bot) {\n        bot.privmsg('#yourchannel', 'hello world!');\n    });\n});\n```\n\n## Documentation\nyirc offers callbacks for IRC commands, providing an error if the command failed. Callbacks are run AFTER the server acknowledged the command, e.g. when the ```join()``` callback fires you can be sure you are actually in the channel!\n\n(psst: they also return promises, see below)\n\n### `new yirc(options)`\nDefault options are located in [defaults.js](./src/defaults.js)\n\n* `autoconnect` - whether or not to connect to the server on instantiation (default: `true`)\n* `nick` - the nick to use when connecting (default: `'ircclient'`)\n* `user` - the user to provide when registering (default: `'ircclient'`)\n* `mode` - the numeric mode to provide when registering (default: `8`)\n* `realName` - the real name to provide when registering (default: `'irc client'`)\n* `host` - the address of the IRC server (default: `'localhost'`)\n* `port` - the port to use when connecting (default: `6667`)\n* `debug` - whether or not to print debug statements to stdout\n* `maxNickLength` - the maximum allowed nick length. If the server advertises a length on connect, that will be used instead. (default: `9`)\n* `maxChannelLength` - the maximum allowed channel name length. If the server advertises a length on connect, that will be used instead. (default: `50`)\n* `quitMessage` - the default message to use for `quit()` (default `'tidal waves of emotion'`)\n\n### Methods\n`connect(callback(err, client))`\n\nConnects to the server and port.\n\n`nick(nick, callback(err, client)`\n\nSends a `NICK` command to the server.\n\n`user(callback(err, client))`\n\nSends a `USER` command to the server. This is performed automatically on `connect()`, and will likely error if used afterwards.\n\n`join(channel, callback(err, client))`\n\nSends a `JOIN` command to the server to join the specified channel.\n\n`part(channel, message, callback(err, client))`\n\nSends a `PART` command to the server to leave the specified channel, with an optional parting message.\n\n`privmsg(target, message)`\n\nSends a `PRIVMSG` command to send a message to the specified target (e.g. nick or channel).\n\n`whois(nick, callback(err, whoisdata))`\n\nSends a `WHOIS` command to the server to query information about the specified nick. `WHOIS` data follows this format:\n```javascript\n{\n    user: \"the username\",\n    host: \"the user's host\",\n    realName: \"the user's realname\",\n    server: \"the server the user is connected to\",\n    serverInfo: \"info about the server\",\n    operator: true,\n    idleTime: \"the amount of time the user has been idle\",\n    away: \"the user's away message\",\n    channels: [\"#channel1\", \"#channel2\", ...],\n    operatorChannels: [\"#channel1\"],\n    moderatedChannels: [],\n}\n```\n\n`quit(quitMessage)`\n\nSends a `QUIT` command to the server. If no `quitMessage` parameter is specified, the default will be used.\n\n### Events\n`on('message', function(messageObject))` - fired when an IRC message is received from the server.\n\nEvery IRC command is also emitted as an event. Example:\n\n`on('PRIVMSG', function(messageObject))` - fired when a `PRIVMSG` is received.\n\n### Message Object\nExample message from the [IRC RFC](http://tools.ietf.org/html/rfc2812#section-3.3.1):\n```javascript\n{\n    raw: \":Angel!wings@irc.org PRIVMSG Wiz :Are you receiving this message ?\",\n    prefix: \":Angel!wings@irc.org\",\n    servername: undefined, // see note\n    nick: \"Angel\",\n    user: \"wings\",\n    host: \"irc.org\",\n    command: \"PRIVMSG\",\n    parameters: ['Wiz', 'Are you receiving this message ?']\n}\n```\n\nNote: not all of the fields will be defined for a message object. The available fields are dependent on the type of the message. See the [RFC](http://tools.ietf.org/html/rfc2812#section-3.3.1) for specific examples!\n\n## Promise!\nAll the methods that take a callback also return a [Q](https://github.com/kriskowal/q) promise, so feel free to use that instead. Example:\n```javascript\nvar yirc = require('yirc');\nvar bot = new yirc({hostname: 'yourserver', port: 6667, nick: 'yournick'});\nbot.on('register', function() {\n    bot.join('#yourchannel')\n       .invoke('privmsg', '#yourchannel', 'hello world!')\n       .invoke('privmsg', '#yourchannel', 'promises are great!')\n\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericnorris%2Firc-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericnorris%2Firc-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericnorris%2Firc-client/lists"}