https://github.com/dgl/redisircd
redis backed IRCd toy
https://github.com/dgl/redisircd
Last synced: about 1 year ago
JSON representation
redis backed IRCd toy
- Host: GitHub
- URL: https://github.com/dgl/redisircd
- Owner: dgl
- License: mit
- Created: 2021-06-27T00:29:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-18T06:42:48.000Z (about 2 years ago)
- Last Synced: 2024-10-11T21:18:46.645Z (over 1 year ago)
- Language: Go
- Size: 40 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Redis IRCd
A redis backed IRC server.
## Whaaaaat?
This is a very simple IRC server, that is backed by Redis. This is mostly a toy
to provide something similar to [irccat](https://github.com/irccloud/irccat),
but running as a server and using Redis, because why not?
A particular use is sending the kind of thing you'd send to Slack via webhooks,
except there are no rate limits, so ideal for lots of data, or just where Slack
doesn't fit well.
This does not scale like a real IRC server would, in particular even if you
were to use a clustered Redis behind this, you'll find out that doesn't
[scale for pubsub](https://github.com/redis/redis/issues/2672).
## Building
For now just build directly from Git, e.g. using Go tooling like so:
```
go install github.com/dgl/redisircd/cmd/redisircd@latest
```
This will give you a `$(go env GOPATH)/bin/redisircd`
(Needs go 1.16, for earlier use `go get` rather than install.)
## Usage
Watch this!
[](https://asciinema.org/a/422798)
or, run redisircd:
```
./redisircd --listen localhost:6667 --redis localhost:6379
```
Connect an IRC client to it.
Then:
```
/join #test
/mode #test +R test
```
Then run: `redis-cli publish test foo`
You should see:
```
foo
```
JSON can be turned on:
```
/mode #test +JTN $.text $.nick
redis-cli publish test '{"text":"hi","nick":"yo"}'
```
Then you should see:
```
hi
```
## Modes
The custom modes this supports start with capital letters.
* `+R channel` Enable redis pubsub, listening on the given channel
* `+J` Redis pubsub payload is formatted as JSON
* `+N` Use JSONPath expression to extract nickname from JSON payload
* `+T` Use JSONPath expression to extract text from JSON payload
* `+P` Enable publishing things said on the channel. Will be sent to the
channel configured with `+R` followed by `:out` to avoid loops (e.g.
`channel:out`).
There's not yet any concept of ops or such. There may never be; this isn't
designed to be available on the public internet.
## Examples
These are designed to show how simple it is to write a bot or other tool for
this. More contributions welcome.
* [hn.sh](examples/hn.sh) is a script to watch for [Hacker
News](https://news.ycombinator.com) updates and publish them.
* [units.sh](examples/units.sh) is a simple script that acts as a frontend to
GNU Units and lets a user interact with it like a calculator.
* [bot.sh](examples/bot.sh) is a wrapper script that can run other carefully
controlled commands.
* You may also be interested in
[redis-irc-bot](https://github.com/dgl/redis-irc-bot) which is mostly
compatible with the `:out` scheme used by `+P` but runs as a bot rather than
a server.