ircmailbot
v1.0.2
Published
A bot which forwards email notifications to IRC (by using irker)
Downloads
4
Readme
IRC Mail Bot
This simple bot is created with Node.js, and it's sole purpose is to receive new email notifications through IMAP in order to forward them to IRC.
Installing
Using npm (note that it will be located in node_modules/ircmailbot
:
npm install ircmailbot
Using git:
git clone https://git.snt.utwente.nl/idb/ircbot.git
cd ircbot
npm install
Configuration
Start by copying the config.json.dist
to config.json
, and edit the values:
IMAP
user
: IMAP usernamepassword
: IMAP passwordhost
: IMAP server (like smtp.gmail.com)port
: IMAP port (like 993)tls
: Eithertrue
orfalse
, enables TLS support.
Irker
host
: Irker instance hostname/ip address/localhostport
: Irker instance portto
: Irker target descriptor
The irker target descriptor looks like irc://irc-url/target
. The irc-url consist of
the hostname and port of the IRC-server (hostname:port
), where the target indicates
the channel/nick to communicate with. Some target examples:
#channel
for a simple channelchannel?key=xxx
for a channel protected by a keynick,isnick
for a simple nick
Function
appname
: Instance name, used in logging onlyprivacy
: Value should be either0
,1
or2
, indicating the privacy level0
: Only a simple notification is sent1
: The subject is added to the notification2
: The sender is added to the notification
readonly
: Eithertrue
orfalse
, whether to open de IMAP box with write permissions. Write permissions are only required when you want to move messages after notification.move
: Eithertrue
offalse
, whether to move messages which have triggered their notification.moveTo
: Ifmove
is set totrue
, this value will indicate the folder where the messaged is moved to.
Running
Simple run:
node app.js
Forever run:
forever start app.js
Automatic run
If you want to have this bot run automatically on system start and restart on crash,
make sure to install the forever
module (sudo npm install -g forever
) and create
the following systemd service file (in /etc/systemd/system/ircmailbot.service
).
In this example, the bot has been installed in /var/www/bot/
.
[Unit]
Description=IRC mail bot NodeJS server
After=network.target
[Service]
User=www-data
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/forever start /var/www/bot/app.js
ExecStop=/usr/bin/forever stopall
[Install]
WantedBy=multi-user.target