diff --git a/README.md b/README.md index 58c3bb2..13f2b33 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ export IRC_USER_NAME="nodebot"; export IRC_REAL_NAME="IRC RADIO BOT"; # L'adresse du serveur mongo et de la base associƩe export MONGO_URL="mongodb://localhost/irc-radio-bot"; +# Le bot souhaite la bienvenue aux arrivants ? +export SAY_HELLO="false" ``` Ne pas oublier d'installer les modules nodejs : diff --git a/index.js b/index.js index 8322309..feecaa0 100644 --- a/index.js +++ b/index.js @@ -76,6 +76,15 @@ bot.addListener(`message${process.env.IRC_CHANNEL}`, function (from, to, message bot.addListener('pm', function (from, to, message) { actions(from, message.args.join(' '), from) }) +// Say hello! +if (process.env.SAY_HELLO && process.env.SAY_HELLO === 'true') { + bot.addListener('join', (channel, who) => { + // Welcome them in! + if (who !== process.env.IRC_NICKNAME) { + botSay(process.env.IRC_CHANNEL, 'Hello ' + who + '! Have a metal day! \\m/(-.-)\\m/') + } + }) +} stream.on('connect', function () { console.info('Radio Stream connected!')