• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H19-Jan-2021-5037

testcases/H19-Jan-2021-

utils/H19-Jan-2021-4,9914,240

.gitignoreH A D19-Jan-202170 75

.gitmodulesH A D19-Jan-202193 43

.golangci.ymlH A D19-Jan-2021240 1614

LICENSEH A D19-Jan-20211 KiB1915

README.mdH A D19-Jan-20213 KiB10983

client.goH A D19-Jan-20217.9 KiB339220

client_handlers.goH A D19-Jan-20213.4 KiB15299

client_test.goH A D19-Jan-202112.5 KiB424353

conn.goH A D19-Jan-20212.7 KiB11265

conn_test.goH A D19-Jan-20213.6 KiB162119

go.modH A D19-Jan-2021106 96

handler.goH A D19-Jan-2021389 178

handler_test.goH A D19-Jan-2021301 2014

numerics.goH A D19-Jan-202127.3 KiB689190

parser.goH A D19-Jan-20218.6 KiB404247

parser_test.goH A D19-Jan-20215.9 KiB273217

stream_test.goH A D19-Jan-20215.5 KiB264203

utils.goH A D19-Jan-2021997 5138

utils_test.goH A D19-Jan-20211 KiB6458

README.md

1# go-irc
2
3[![GoDoc](https://img.shields.io/badge/doc-GoDoc-blue.svg)](https://godoc.org/github.com/go-irc/irc)
4[![Build Status](https://img.shields.io/github/workflow/status/go-irc/irc/CI.svg)](https://github.com/go-irc/irc/actions)
5[![Coverage Status](https://img.shields.io/coveralls/go-irc/irc.svg)](https://coveralls.io/github/go-irc/irc?branch=master)
6
7This package was originally created to only handle message parsing,
8but has since been expanded to include a small abstraction around a
9connection and a simple client.
10
11This library is not designed to hide any of the IRC elements from
12you. If you just want to build a simple chat bot and don't want to
13deal with IRC in particular, there are a number of other libraries
14which provide a more full featured client if that's what you're
15looking for.
16
17This library is meant to stay as simple as possible so it can be a
18building block for other packages.
19
20This library aims for API compatibility whenever possible. New
21functions and other additions will most likely not result in a major
22version increase unless they break the API. This library aims to
23follow the semver recommendations mentioned on gopkg.in.
24
25Due to complications in how to support x/net/context vs the built-in context
26package, only go 1.7+ is officially supported.
27
28## Import Paths
29
30All development happens on the `master` branch and when features are
31considered stable enough, a new release will be tagged.
32
33* `gopkg.in/irc.v3` should be used to develop against the commits
34  tagged as stable
35* In previous versions, `github.com/go-irc/irc` used to be able to be
36  used to develop against the master branch but module support in go
37  seems to have broken this.
38
39## Development
40
41In order to run the tests, make sure all submodules are up to date. If you are
42just using this library, these are not needed.
43
44## Example
45
46```go
47package main
48
49import (
50	"log"
51	"net"
52
53	"gopkg.in/irc.v3"
54)
55
56func main() {
57	conn, err := net.Dial("tcp", "chat.freenode.net:6667")
58	if err != nil {
59		log.Fatalln(err)
60	}
61
62	config := irc.ClientConfig{
63		Nick: "i_have_a_nick",
64		Pass: "password",
65		User: "username",
66		Name: "Full Name",
67		Handler: irc.HandlerFunc(func(c *irc.Client, m *irc.Message) {
68			if m.Command == "001" {
69				// 001 is a welcome event, so we join channels there
70				c.Write("JOIN #bot-test-chan")
71			} else if m.Command == "PRIVMSG" && c.FromChannel(m) {
72				// Create a handler on all messages.
73				c.WriteMessage(&irc.Message{
74					Command: "PRIVMSG",
75					Params: []string{
76						m.Params[0],
77						m.Trailing(),
78					},
79				})
80			}
81		}),
82	}
83
84	// Create the client
85	client := irc.NewClient(conn, config)
86	err = client.Run()
87	if err != nil {
88		log.Fatalln(err)
89	}
90}
91```
92
93## Major Version Changes
94
95### v1
96
97Initial release
98
99### v2
100
101- CTCP messages will no longer be rewritten. The decision was made that this
102  library should pass through all messages without mangling them.
103- Remove Message.FromChannel as this is not always accurate, while
104  Client.FromChannel should always be accurate.
105
106### v3
107
108- Import path changed back to `gopkg.in/irc.v3` without the version suffix.
109