• This repository has been archived on 15/Nov/2018
  • Stars
    star
    276
  • Rank 149,319 (Top 3 %)
  • Language
    Java
  • License
    GNU General Publi...
  • Created almost 16 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

IRC bot that simplifies posting to IRC from shell scripts

Archived - See irccloud/irccat

I'm not running this java version any more, please see this irccat clone in go.

IRCcat

As in cat to IRC.

IRCcat does 2 things:

  1. Listens on a specific ip:port and writes incoming data to an IRC channel. This is useful for sending various announcements and log messages to irc from shell scripts, Nagios and other services.

  2. Hands off commands issued on irc to a handler program (eg: shell script) and responds to irc with the output of the handler script. This only happens for commands addressed to irccat: or prefixed with ?. (easily extend irccat functionality with your own scripts)

Installation

Edit the irccat.xml so it knows which irc server, channel etc.. Check you have sun jvm >=1.5 (java -version)

This will build and package irccat as a jar:

$ ant dist

Then, using the appropriate config file:

$ ant -Dconfigfile=./examples/irccat.xml run

Also, you'll probably want to install netcat.

Sending text to IRC

By default IRCCat listens on 127.0.0.1:12345, and sends data to the default (first) channels. In a networked server environment you will p robably want to make it listen on the private LAN interface.

Examples:

$ echo "Hello World" | netcat -q0 localhost 12345 $ tail -f /var/log/www/error.log | netcat localhost 12345

In a server environment, consider adding a hostname to your internal DNS or using a virtual IP for irccat to listen on, in case you want to move irccat to another box later.

Sending to specific channels

To send to a specific channel rather than the default, put the channel name as the first word in the data (the channel name will be stripped):

$ echo "#mychannel hello world" | netcat -q0 machinename 12345

This sends "hello world" to #mychannel

First word defines the recipients, you can use comma separated list.

prefix indicates channel, @ indicates a nick.

Examples:

- "#chan blah blah"
  just sends to #chan

- "@RJ psst, this is a pm"
  just sends via PM to user RJ

- "#channel1,#channel2,@RJ,@Russ blah blah this is the message"
  this sends to 2 channels, and 2 users (RJ, Russ)

- "#* Attention, something important"
  this sends to all channels the bot is in	

- "#chan %REDroses are red%NORMAL, grass is #GREENgreen#NORMAL"
  you can use colors too, see IRCCat.java for the full list;
  Either "#" or "%" will work.

Changing topics in channels

To change the topic in a channel (rather than sending a message), use the prefix %TOPIC.

$ echo "%TOPIC #mychannel hello world" | netcat -q0 machinename 12345

This changes the topic of #mychannel to "hello world" (assuming the bot has permission to set the topic)

Second word defines the recipient channels. You can use a comma separated list. Nick recipients will be accepted, but silently ignored.

Examples:

  • "%TOPIC #chan new topic" just changes the topic of #chan

  • "%TOPIC #channel1,#channel2 this channel is great" this changes the topics of two channels

  • "%TOPIC #* Important Topic" this changes the topics in all channels the bot is in

Built-in commands

There are a handful of built-in commands for instructing the bot at runtime.

Built-in commands are prefixed with a !

!join #chan pass		- joins another channel. pass is optional
!part #chan				- parts chan
!channels				- lists channels the bot is in
!spam blah blah..		- repeats your message in all joined channels
!exit					- System.exit()

Trust

Any command (?.. !..) uttered in a channel with irccat in is executed and implicitly trusted.

Any command PMed to irccat is ignored unless the user is joined to the default (first) channel in the config file.

SVN commit notifications

svn hooks let you announce commits etc. For example, try this in your SVN repo/hooks/post-commit file:

REPOS="$1" REV="$2" LOG=/usr/bin/svnlook log -r $REV $REPOS AUTHOR=/usr/bin/svnlook author -r $REV $REPOS echo "SVN commit by $AUTHOR (r$REV) '$LOG' http://web-svn-interface.example.com/?rev=$REV" | netcat -q0 machinename 12345

Nagios alerts to irc

Buried in our nagios config is this, from misccommands.cfg:

define command { command_name host-notify-by-irc command_line /bin/echo "#sys Nagios: Host '$HOSTALIAS$' is $HOSTSTATE$ - Info: $OUTPUT$" | /bin/netcat -q 1 irccathost 12345 }

define command { command_name service-notify-by-irc command_line /bin/echo "#sys Nagios: Service $SERVICEDESC$ on '$HOSTALIAS$' is $SERVICESTATE$ - Info: $OUTPUT$" | /bin/netcat -q 1 irccathost 12345 }

And in contacts.cfg:

define contact{ contact_name irccat alias irccat service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,c,r host_notification_options d,r service_notification_commands service-notify-by-irc host_notification_commands host-notify-by-irc email blah@blah }

Feedback

Email: [email protected] Web: http://www.last.fm/user/RJ (work, and the reason irccat exists) Web: http://www.metabrew.com/ (blog) Irc: irc://irc.audioscrobbler.com/audioscrobbler

More Repositories

1

ketama

C library for consistent hashing, and langauge bindings
C
825
star
2

playdar-core

Playdar - a content resolver for music
PHP
192
star
3

erlang-spdy

Library implementing the SPDY protocol
Erlang
104
star
4

relflow

Version-incrementing, appup-generating, relx-coaxing, workflow-assistant for Erlang projects using rebar3.
Erlang
92
star
5

estatsd

Erlang stats aggregation app that periodically flushes data to graphite
Erlang
88
star
6

playdar

Abandoned C++ codebase, see playdar-core repo!
C
49
star
7

heatmiser-neohub.py

Python library to talk the direct-lan-api to control a Heatmiser Neohub / Neostats - and home-assistant component
Python
31
star
8

erlang_rebar_example_project

Basic project using rebar, to demonstrate upgrades and packaging etc
Erlang
24
star
9

erlang-reup

Watches for .erl & .hrl changes, recompiles and reloads. You know, for development.
Erlang
24
star
10

erlang-cassandra-cql

cassandra driver in erlang that speaks native cassandra protocol
Erlang
22
star
11

mochiweb-websockets

***OBSOLETE, using my mochiweb repo now ***
Erlang
20
star
12

libf2f

Library for building p2p networks, C++ boost/asio
C++
16
star
13

libportfwd

Set up port fwds and find external IP: C++/CMake wrapper for miniupnpc and nat-pmp libs
C
14
star
14

greynet

A darknet/mesh network plugin for legacy C++ playdar codebase
C++
11
star
15

doorbird-mdns-vlan-subnet-bridge

Allow ios/android apps to discover and direct connect to doorbirds in a different subnet
Python
8
star
16

gocat

IRCCat in Go
Go
7
star
17

musickit

Qt+Webkit container app that exposes phonon/etc APIs to js
JavaScript
6
star
18

logtail

tail -f logfiles in a browser using websockets (erlang)
Erlang
6
star
19

sonos-shipping-forecast

Play the Shipping Forecast from BBC Radio 4, then return Sonos to original state.
Python
6
star
20

libmemcached

temporary repo for patching libmemcached
Shell
6
star
21

dotvim

my .vim
Vim Script
5
star
22

www.playdar.org

Playdar website
JavaScript
5
star
23

bevy_timewarp

A rollback library that buffers component state. Useful for netcode.
Rust
5
star
24

captainhook

Batch set github service hooks for all repos in an org
Python
4
star
25

vagrant-chef-basebox

Basic vagrant+chef setup
Ruby
4
star
26

estr-erlang-elixir-binary-string

Adaptor for using Elixir's UTF8 binary string module in Erlang
Erlang
3
star
27

bevy_naia_laminar

bevy plugin for laminar atop naia-socket
Rust
2
star
28

appupper

deprecated, see relflow:
Erlang
2
star
29

relsandbox

Release sandbox app (various changes, with appups)
Erlang
2
star
30

irccat-cookbook

chef cookbook for irccat
HTML
2
star
31

dot-janus

My .janus dir, containing vim config and plugins in addition to janus vim distro
Vim Script
2
star
32

erlang-countess

rebar3 release playground for blog post
Erlang
1
star
33

qdaapd

An embeddable C++/Qt DAAP server library
C
1
star
34

conjist

music network thing
C
1
star
35

radioblink

WIP - Circuit which takes the audio output of a PMR radio and blinks LEDs when it receives a signal
C
1
star
36

sharesight-custom-investment-price-updater

updates vg small cap price to sharesight
Rust
1
star