This commit is contained in:
nioc 2019-11-21 22:38:10 +01:00
parent 48046dbae2
commit 2898b88253
5 changed files with 12 additions and 4 deletions

View file

@ -5,7 +5,7 @@ After=network.target
[Service]
User=xmpp-bot
WorkingDirectory=/usr/local/bin/xmpp-bot/lib/
WorkingDirectory=/usr/local/bin/xmpp-bot/
ExecStart=/usr/bin/node /usr/local/bin/xmpp-bot/lib/server.js
Restart=on-failure
RestartSec=1000ms

View file

@ -45,6 +45,7 @@
"domain": "domain-xmpp.ltd",
"username": "bot@domain-xmpp.ltd",
"password": "botPass",
"resource": "botservice",
"rooms": [
{
"id": "roomname@conference.domain-xmpp.ltd",

View file

@ -15,7 +15,9 @@ module.exports = (logger, xmpp) => {
logger.warn(`Received ${exitCode}/${signal} (application is closing), disconnect from XMPP server`)
try {
xmpp.close()
.then(logger.debug('Connection successfully closed'))
.then(() => {
logger.debug('Connection successfully closed')
})
.catch((error) => {
logger.error('Error during XMPP disconnection', error)
})

View file

@ -45,7 +45,9 @@ module.exports = (logger, config) => {
this.jid = address
// send presence
xmppClient.send(xml('presence'))
.then(logger.debug('presence sent'))
.then(() => {
logger.debug('presence sent')
})
.catch((error) => {
logger.warn('presence returned following error:', error)
})
@ -139,7 +141,9 @@ module.exports = (logger, config) => {
// connect
xmppClient.start()
.catch(logger.error)
.catch((error) => {
logger.error('XMPP client encountered following error at connection', error)
})
return this
}

View file

@ -45,6 +45,7 @@
"domain": "domain-xmpp.ltd",
"username": "bot@domain-xmpp.ltd",
"password": "botPass",
"resource": "botservice",
"rooms": [
{
"id": "roomname@conference.domain-xmpp.ltd",