mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Fix
This commit is contained in:
@@ -35,14 +35,20 @@ module.exports = class PokerCommand extends Command {
|
|||||||
async run(msg, { playersCount }) {
|
async run(msg, { playersCount }) {
|
||||||
const current = this.client.games.get(msg.channel.id);
|
const current = this.client.games.get(msg.channel.id);
|
||||||
if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`);
|
if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`);
|
||||||
this.client.games.set(msg.channel.id, { name: this.name, data: new Deck() });
|
this.client.games.set(msg.channel.id, {
|
||||||
|
name: this.name,
|
||||||
|
data: {
|
||||||
|
deck: new Deck(),
|
||||||
|
players: new Collection()
|
||||||
|
}
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await this.awaitPlayers(msg, playersCount);
|
const awaitedPlayers = await this.awaitPlayers(msg, playersCount);
|
||||||
if (!awaitedPlayers) {
|
if (!awaitedPlayers) {
|
||||||
this.client.games.delete(msg.channel.id);
|
this.client.games.delete(msg.channel.id);
|
||||||
return msg.say('Game could not be started...');
|
return msg.say('Game could not be started...');
|
||||||
}
|
}
|
||||||
const players = new Collection();
|
const players = this.client.games.get(msg.channel.id).data.players;
|
||||||
for (const player of awaitedPlayers) {
|
for (const player of awaitedPlayers) {
|
||||||
players.set(player, {
|
players.set(player, {
|
||||||
money: 5000,
|
money: 5000,
|
||||||
@@ -52,7 +58,7 @@ module.exports = class PokerCommand extends Command {
|
|||||||
currentBet: 0
|
currentBet: 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const deck = this.client.games.get(msg.channel.id).data;
|
const deck = this.client.games.get(msg.channel.id).data.deck;
|
||||||
let winner = null;
|
let winner = null;
|
||||||
const rotation = players.map(p => p.id);
|
const rotation = players.map(p => p.id);
|
||||||
while (!winner) {
|
while (!winner) {
|
||||||
|
|||||||
Reference in New Issue
Block a user