Added say hello on join

This commit is contained in:
dbroqua 2019-12-25 09:40:18 +01:00
parent 063c0eb267
commit 6947fb843e
2 changed files with 11 additions and 0 deletions

View File

@ -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 :

View File

@ -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!')