Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 87 lines (55 sloc) 2.626 kB
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
1 `node-irc`_ is an IRC client library written in JavaScript_ for Node_.
f30952b @martynsmith Initial revision
martynsmith authored
2
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
3 .. _`node-irc`: http://node-irc.readthedocs.org/
4 .. _JavaScript: http://en.wikipedia.org/wiki/JavaScript
5 .. _Node: http://nodejs.org/
6
4e2ec54 @martynsmith Provide a link to Read the Docs documentation
martynsmith authored
7 You can access more detailed documentation for this module at `Read the Docs`_
8
9
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
10 Installation
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
11 -------------
12
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
13 The easiest way to get it is via npm_::
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
14
15 npm install irc
16
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
17 If you want to run the latest version (i.e. later than the version available via
18 npm_) you can clone this repo, then use npm_ to link-install it::
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
19
20 npm link /path/to/your/clone
21
22 Of course, you can just clone this, and manually point at the library itself,
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
23 but I really recommend using npm_!
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
24
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
25 Basic Usage
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
26 -------------
27
f30952b @martynsmith Initial revision
martynsmith authored
28 This library provides basic IRC client functionality. In the simplest case you
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
29 can connect to an IRC server like so::
f30952b @martynsmith Initial revision
martynsmith authored
30
b470887 Fixed documentation for creating a new client
Martyn Smith authored
31 var irc = require('irc');
32 var client = new irc.Client('irc.dollyfish.net.nz', 'myNick', {
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
33 channels: ['#blah'],
f30952b @martynsmith Initial revision
martynsmith authored
34 });
35
36 Of course it's not much use once it's connected if that's all you have!
37
38 The client emits a large number of events that correlate to things you'd
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
39 normally see in your favourite IRC client. Most likely the first one you'll want
40 to use is::
f30952b @martynsmith Initial revision
martynsmith authored
41
42 client.addListener('message', function (from, to, message) {
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
43 console.log(from + ' => ' + to + ': ' + message);
f30952b @martynsmith Initial revision
martynsmith authored
44 });
45
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
46 or if you're only interested in messages to the bot itself::
f30952b @martynsmith Initial revision
martynsmith authored
47
30b1209 @martynsmith Updated top-level README file
martynsmith authored
48 client.addListener('pm', function (from, message) {
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
49 console.log(from + ' => ME: ' + message);
30b1209 @martynsmith Updated top-level README file
martynsmith authored
50 });
51
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
52 or to a particular channel::
30b1209 @martynsmith Updated top-level README file
martynsmith authored
53
54 client.addListener('message#yourchannel', function (from, message) {
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
55 console.log(from + ' => #yourchannel: ' + message);
30b1209 @martynsmith Updated top-level README file
martynsmith authored
56 });
57
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
58 At the moment there are functions for joining::
30b1209 @martynsmith Updated top-level README file
martynsmith authored
59
233cc43 @wraithan Adding catshirt (Nic Luciano)'s changes to evl's branch
wraithan authored
60 client.join('#yourchannel yourpass');
30b1209 @martynsmith Updated top-level README file
martynsmith authored
61
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
62 parting::
30b1209 @martynsmith Updated top-level README file
martynsmith authored
63
64 client.part('#yourchannel');
65
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
66 talking::
30b1209 @martynsmith Updated top-level README file
martynsmith authored
67
bf87760 @martynsmith Added documentation for notice method
martynsmith authored
68 client.say('#yourchannel', "I'm a bot!");
69 client.say('nonbeliever', "SRSLY, I AM!");
70
3e0948a Implemented whois method and event
Martyn Smith authored
71 and many others. Check out the API documentation for a complete reference.
bf87760 @martynsmith Added documentation for notice method
martynsmith authored
72
3e0948a Implemented whois method and event
Martyn Smith authored
73 For any commands that there aren't methods for you can use the send() method
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
74 which sends raw messages to the server::
30b1209 @martynsmith Updated top-level README file
martynsmith authored
75
76 client.send('MODE', '#yourchannel', '+o', 'yournick');
f30952b @martynsmith Initial revision
martynsmith authored
77
42e2a81 @martynsmith Fixed end of the README.rst file to point to Read the Docs
martynsmith authored
78 Further documentation (including a complete API reference) are available in
79 reStructuredText format in the docs/ folder of this project, or online at `Read the Docs`_.
80
81 If you find any issues with the documentation (or the module) please send a pull
82 request or file an issue and I'll do my best to accommodate.
b7574a3 @martynsmith Added information about npm to README
martynsmith authored
83
c1152b3 @wraithan first pass at sphinx docs
wraithan authored
84 .. _npm: http://github.com/isaacs/npm
85 .. _here: http://node-irc.readthedocs.org/en/latest/API.html
42e2a81 @martynsmith Fixed end of the README.rst file to point to Read the Docs
martynsmith authored
86 .. _`Read the Docs`: http://readthedocs.org/docs/node-irc/en/latest/
Something went wrong with that request. Please try again.