imageGenerator check

This commit is contained in:
ale 2021-01-28 13:19:20 +01:00
parent 70c51bb4fe
commit af131189f9

View File

@ -66,8 +66,10 @@ xmpp.on('stanza', async stanza => {
)).catch(console.error)
}
} else if (stanza.is('iq') && stanza.attrs.type === 'result') {
if (imageGenerator) {
const buf = await imageGenerator.generateBuffer()
if (imageGenerator && buf.byteLength > 0 && stanza.getChild('slot') && stanza.getChild('slot').getChild('put')) {
if (buf.byteLength > 0 && stanza.getChild('slot')
&& stanza.getChild('slot').getChild('put')) {
const req = await got.put(stanza.getChild('slot').getChild('put').attrs.url, {
body: buf
}).catch(console.error)
@ -76,6 +78,7 @@ xmpp.on('stanza', async stanza => {
}
}
}
}
})
xmpp.on('online', async address => {