connect4-discord
v0.1.1
Published
<h3><a href="https://krypton.sergioesquina.repl.co/npm/discord-c4">Discord-C4</a>, crea un tablero, y checkea una partida de Conecta 4
Downloads
22
Maintainers
Readme
let { checker, board } = require("connect4-discord")
/*
buttons: Array de botones [ [MessageActionRow], [MessageActionRow], [MessageActionRow], [MessageActionRow], [MessageActionRow] ]
player: Usuario que acaba de reaccionar al botón
*/
message.channel.send({content: "Conecta4", components: [new board(Discord)]}).then(m => {
let turno, turnonum
let filter = btn => {
// Otras comprobaciones
//Turnos
if(turnonum == 0) turnonum++
else turnonum--
let checked = new checker([row1, row2, row3, row4, row5], turno)
if(checked.status == "end") return m.edit(`${checked.member.user.username} HA GANADO EL JUEGO!!`)
// Cosas para que cambie el botón presionado
// Turnos
if(turnonum == 0) turno = message.member
else turno = message.mentions.members.first()
}
m.awaitMessageComponent(...)
})
/*
Discord: Discord<Discord.JS>
size: Number<Integer>
*/
let tablero = new dc4.board(Discord)
console.log(tablero)
/*
tablero: Array de botones [ [MessageActionRow], [MessageActionRow], [MessageActionRow], [MessageActionRow], [MessageActionRow] ]
player: Usuario que acaba de reaccionar al botón
*/
new checker(tablero, turno).then((status, member) => {
if(status == "end") message.channel.send(member.toString()+" ha ganado la partida")
})
require("connect4-discord").discord