correct move ids

This commit is contained in:
ale 2021-01-28 14:13:28 +01:00
parent b4fd4f976c
commit fe0a35c54e

View File

@ -1,5 +1,3 @@
const { delete } = require('got')
const { client, xml } = require('@xmpp/client'), const { client, xml } = require('@xmpp/client'),
got = require('got'), got = require('got'),
config = require('./config'), config = require('./config'),
@ -32,8 +30,8 @@ xmpp.on('stanza', async stanza => {
sendMessage('Jaque mate. Juego terminado.') sendMessage('Jaque mate. Juego terminado.')
} else if (message && message.split(' ').length === 3 } else if (message && message.split(' ').length === 3
&& message.split(' ')[0] === '.move' && message.split(' ')[0] === '.move'
&& message.split(' ')[1].match(/^[A-H1-8]{2}$/) && message.split(' ')[1].match(/^[A-H]{1}[1-8]{1}$/)
&& message.split(' ')[2].match(/^[A-H1-8]{2}$/)) { && message.split(' ')[2].match(/^[A-H]{1}[1-8]{1}$/)) {
const msg = message.split(' ') const msg = message.split(' ')
msg.shift() msg.shift()
game.move(msg[0], msg[1]) game.move(msg[0], msg[1])
@ -77,7 +75,7 @@ xmpp.on('stanza', async stanza => {
body: buf body: buf
}).catch(console.error) }).catch(console.error)
if (req && req.url && time) { 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 imageGenerator = null
time = null time = null
} }