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] [Service]
User=xmpp-bot 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 ExecStart=/usr/bin/node /usr/local/bin/xmpp-bot/lib/server.js
Restart=on-failure Restart=on-failure
RestartSec=1000ms RestartSec=1000ms

View file

@ -45,6 +45,7 @@
"domain": "domain-xmpp.ltd", "domain": "domain-xmpp.ltd",
"username": "bot@domain-xmpp.ltd", "username": "bot@domain-xmpp.ltd",
"password": "botPass", "password": "botPass",
"resource": "botservice",
"rooms": [ "rooms": [
{ {
"id": "roomname@conference.domain-xmpp.ltd", "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`) logger.warn(`Received ${exitCode}/${signal} (application is closing), disconnect from XMPP server`)
try { try {
xmpp.close() xmpp.close()
.then(logger.debug('Connection successfully closed')) .then(() => {
logger.debug('Connection successfully closed')
})
.catch((error) => { .catch((error) => {
logger.error('Error during XMPP disconnection', error) logger.error('Error during XMPP disconnection', error)
}) })

View file

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

View file

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