Debian Codegraph @

README.markdown

raw symbols SCIP
1 Description
2 -----------
3
4 Event based irc client library.
5
6
7 Features
8 --------
9 * Event based. Register Callbacks for the events you need to handle.
10 * Handles basic irc demands for you
11 * Standard CTCP
12 * Reconnections on errors
13 * Detect stoned servers
14
15 Install
16 -------
17 $ go get github.com/thoj/go-ircevent
18
19 Example
20 -------
21 See [examples/simple/simple.go](examples/simple/simple.go) and [irc_test.go](irc_test.go)
22
23 Events for callbacks
24 --------------------
25 * 001 Welcome
26 * PING
27 * CTCP Unknown CTCP
28 * CTCP_VERSION Version request (Handled internaly)
29 * CTCP_USERINFO
30 * CTCP_CLIENTINFO
31 * CTCP_TIME
32 * CTCP_PING
33 * CTCP_ACTION (/me)
34 * PRIVMSG
35 * MODE
36 * JOIN
37
38 +Many more
39
40
41 AddCallback Example
42 -------------------
43 ircobj.AddCallback("PRIVMSG", func(event *irc.Event) {
44 //event.Message() contains the message
45 //event.Nick Contains the sender
46 //event.Arguments[0] Contains the channel
47 });
48
49 Please note: Callbacks are run in the main thread. If a callback needs a long
50 time to execute please run it in a new thread.
51
52 Example:
53
54 ircobj.AddCallback("PRIVMSG", func(event *irc.Event) {
55 go func(event *irc.Event) {
56 //event.Message() contains the message
57 //event.Nick Contains the sender
58 //event.Arguments[0] Contains the channel
59 }(event)
60 });
61
62
63 Commands
64 --------
65 ircobj := irc.IRC("<nick>", "<user>") //Create new ircobj
66 //Set options
67 ircobj.UseTLS = true //default is false
68 //ircobj.TLSOptions //set ssl options
69 ircobj.Password = "[server password]"
70 //Commands
71 ircobj.Connect("irc.someserver.com:6667") //Connect to server
72 ircobj.SendRaw("<string>") //sends string to server. Adds \r\n
73 ircobj.SendRawf("<formatstring>", ...) //sends formatted string to server.n
74 ircobj.Join("<#channel> [password]")
75 ircobj.Nick("newnick")
76 ircobj.Privmsg("<nickname | #channel>", "msg") // sends a message to either a certain nick or a channel
77 ircobj.Privmsgf(<nickname | #channel>, "<formatstring>", ...)
78 ircobj.Notice("<nickname | #channel>", "msg")
79 ircobj.Noticef("<nickname | #channel>", "<formatstring>", ...)