~exelotl/forum2irc

IRC bot to notify of new forum topics

clone

read-only
https://git.sr.ht/~exelotl/forum2irc
read/write
git@git.sr.ht:~exelotl/forum2irc

You can also use your local clone with git send-email.

#forum2irc

This is an IRC bot that repeatedly checks a web forum for new topics and relays them to an IRC channel. To achieve this, it checks the forum's Atom feed for any topic with an ID higher than the last known topic.

The output looks like this:

<ForumBot> New topic by Krom in News • A game programming tutorial https://forum.gbadev.org/viewtopic.php?t=3143

The bot assumes topic IDs are strictly incremental, and that the Atom feed contains the latest topic somewhere (very likely). The latest topic ID is saved in last_topic.txt by default in the current directory.

#Compatibility

The following forums have been tested:

Type Atom URL More info
phpBB https://forum.example.com/feed.php link
Simple Machines https://forum.example.com/index.php?action=.xml&type=atom link
flaskbb https://forum.example.com/atom plugin

#Installation & Usage

You need the Nim compiler (and Nimble package manager).

# install it locally
nimble install https://git.sr.ht/~exelotl/forum2irc

# run with desired options
forum2irc \
  --server:"irc.example.net" \
  --nick:"ForumBot" \
  --channel:"#foobar" \
  --atomUrl:"https://forum.example.com/feed.php"

#Full list of options

Required options:
  --atomUrl:URL    URL of the Atom feed e.g. "https://forum.example.com/feed.php"
  --server:HOST    Domain of the IRC server e.g. "irc.esper.net"
  --channel:CHAN   The channel to join, e.g. "#foobar"
  --nick:NICK      The nickname & username for the bot.

Additional options:
  --rate:MINUTES   How often to check the feed. Defaults to 5 minutes.
  --filename:FILE  Where to store last topic ID. Defaults to "last_topic.txt".
  --port:PORT      The port of the IRC server. Defaults to 6667.
  --pass:PASS      The user's password.
  --sasl           Login via SASL instead of NickServ.
  --dumpOnly       Don't join IRC. Write new topics to the terminal & quit.

Note: --dumpOnly is useful for testing, but you'll have to edit the ID in last_topic.txt to make it print anything.

#Deployment

In theory, you can deploy on a Linux server by just dropping in your compiled binary.

If this doesn't work (because your local machine has a different OS or CPU architecture to the server, or the shared libs are incompatible) a decent solution is to generate C sources on your machine and then compile them on the server. Example:

git clone https://git.sr.ht/~exelotl/forum2irc
cd forum2irc
nimble install -d   # install deps only

# output C sources and buildscript to local "build" dir
nimble build --genscript:on --nimcache:build --os:linux --cpu:amd64

# copy nimbase.h to local "build" dir
cp `choosenim show path`/lib/nimbase.h build

# mark script as executable
chmod +x build/compile_forum2irc.sh

Then copy the build directory to your server and run ./compile_forum2irc.sh to obtain an executable.

Do not follow this link