From 82b0ca24a728a1866fb740dcdf582f08df023e6c Mon Sep 17 00:00:00 2001 From: ale Date: Thu, 28 Jan 2021 14:15:21 +0100 Subject: [PATCH] refactor url --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 92c3b30..9f378d5 100644 --- a/index.js +++ b/index.js @@ -71,11 +71,12 @@ xmpp.on('stanza', async stanza => { const buf = await imageGenerator.generateBuffer() 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) + const url = stanza.getChild('slot').getChild('put').attrs.url, + req = await got.put(url, { + body: buf + }).catch(console.error) if (req && req.url && time) { - sendMessage(`Su turno: ${req.url} movimiento IA en ${time / 1000} s`) + sendMessage(`Su turno: ${req.url} movimiento IA en ${time / 1000}s`) imageGenerator = null time = null }