mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix all awaitMessages
This commit is contained in:
@@ -96,7 +96,8 @@ module.exports = class ApplesToApplesCommand extends Command {
|
||||
if (!cards[Number.parseInt(res.content, 10) - 1]) return false;
|
||||
return true;
|
||||
};
|
||||
const chosen = await msg.channel.awaitMessages(filter, {
|
||||
const chosen = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ module.exports = class BingoCommand extends Command {
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const bingo = await msg.channel.awaitMessages(filter, { max: 1, time: 20000 });
|
||||
const bingo = await msg.channel.awaitMessages({ filter, max: 1, time: 20000 });
|
||||
if (!players.size) {
|
||||
winner = 0;
|
||||
break;
|
||||
|
||||
@@ -380,7 +380,8 @@ module.exports = class CarRaceCommand extends Command {
|
||||
if (res.author.id !== msg.author.id) return false;
|
||||
return Object.keys(difficulties).includes(res.content.toLowerCase());
|
||||
};
|
||||
const difficultyPick = await msg.channel.awaitMessages(difficultyFilter, {
|
||||
const difficultyPick = await msg.channel.awaitMessages({
|
||||
filter: difficultyFilter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -405,7 +406,8 @@ module.exports = class CarRaceCommand extends Command {
|
||||
if (res.author.id !== opponent.id) return false;
|
||||
return available.includes(res.content.toLowerCase());
|
||||
};
|
||||
const p2Car = await msg.channel.awaitMessages(filter, {
|
||||
const p2Car = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -448,7 +450,8 @@ module.exports = class CarRaceCommand extends Command {
|
||||
if (![opponent.id, msg.author.id].includes(res.author.id)) return false;
|
||||
return res.content.toLowerCase() === 'end';
|
||||
};
|
||||
const earlyEnd = await msg.channel.awaitMessages(earlyFilter, {
|
||||
const earlyEnd = await msg.channel.awaitMessages({
|
||||
filter: earlyFilter,
|
||||
max: 1,
|
||||
time: randomRange(1000, 30000)
|
||||
});
|
||||
@@ -464,7 +467,8 @@ module.exports = class CarRaceCommand extends Command {
|
||||
if (res.content.toLowerCase() === 'end') return true;
|
||||
return res.content.toLowerCase() === word;
|
||||
};
|
||||
const winner = await msg.channel.awaitMessages(turnFilter, {
|
||||
const winner = await msg.channel.awaitMessages({
|
||||
filter: turnFilter,
|
||||
max: 1,
|
||||
time: opponent.bot ? difficulties[difficulty] : 30000
|
||||
});
|
||||
|
||||
@@ -96,7 +96,8 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
|
||||
if (!cards[Number.parseInt(res.content, 10) - 1]) return false;
|
||||
return true;
|
||||
};
|
||||
const chosen = await msg.channel.awaitMessages(filter, {
|
||||
const chosen = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
|
||||
@@ -88,7 +88,8 @@ module.exports = class ConnectFourCommand extends Command {
|
||||
if (hasCustom && msg.guild && !msg.guild.emojis.cache.has(hasCustom[2])) return false;
|
||||
return (hasCustom && msg.guild) || hasEmoji || available.includes(res.content.toLowerCase());
|
||||
};
|
||||
const p2Color = await msg.channel.awaitMessages(filter, {
|
||||
const p2Color = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -133,7 +134,8 @@ module.exports = class ConnectFourCommand extends Command {
|
||||
const j = Number.parseInt(choice, 10) - 1;
|
||||
return board[colLevels[j]] && board[colLevels[j]][j] !== undefined;
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(pickFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: pickFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -62,7 +62,8 @@ module.exports = class CramCommand extends Command {
|
||||
if (res.author.id !== opponent.id) return false;
|
||||
return available.includes(res.content.toLowerCase());
|
||||
};
|
||||
const p2Color = await msg.channel.awaitMessages(filter, {
|
||||
const p2Color = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -93,7 +94,8 @@ module.exports = class CramCommand extends Command {
|
||||
if (!possibleMoves.includes(`${direction}${x - 1},${y - 1}`)) return false;
|
||||
return true;
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(colorFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: colorFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -62,7 +62,8 @@ module.exports = class DomineeringCommand extends Command {
|
||||
if (res.author.id !== opponent.id) return false;
|
||||
return available.includes(res.content.toLowerCase());
|
||||
};
|
||||
const p2Color = await msg.channel.awaitMessages(filter, {
|
||||
const p2Color = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -92,7 +93,8 @@ module.exports = class DomineeringCommand extends Command {
|
||||
if (!possibleMoves.includes(`${x - 1},${y - 1}`)) return false;
|
||||
return true;
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(colorFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: colorFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -79,7 +79,8 @@ module.exports = class DotsAndBoxesCommand extends Command {
|
||||
}
|
||||
return !taken.includes(`${first}-${second}`);
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(filter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -54,7 +54,8 @@ module.exports = class EmojiEmojiRevolutionCommand extends Command {
|
||||
const emoji = [emojis[num], emojisNew[num]];
|
||||
await msg.say(emojisNew[num]);
|
||||
const filter = res => [msg.author.id, opponent.id].includes(res.author.id) && emoji.includes(res.content);
|
||||
const win = await msg.channel.awaitMessages(filter, {
|
||||
const win = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -90,7 +90,8 @@ module.exports = class GuesspionageCommand extends Command {
|
||||
const int = Number.parseInt(res.content, 10);
|
||||
return int >= 0 && int <= 100;
|
||||
};
|
||||
const initialGuess = await msg.channel.awaitMessages(initialGuessFilter, {
|
||||
const initialGuess = await msg.channel.awaitMessages({
|
||||
filter: initialGuessFilter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -115,7 +116,8 @@ module.exports = class GuesspionageCommand extends Command {
|
||||
reactIfAble(res, res.author, SUCCESS_EMOJI_ID, '✅');
|
||||
return true;
|
||||
};
|
||||
const everyoneElse = await msg.channel.awaitMessages(everyoneElseFilter, {
|
||||
const everyoneElse = await msg.channel.awaitMessages({
|
||||
filter: everyoneElseFilter,
|
||||
max: awaitedPlayers.length - 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -42,7 +42,8 @@ module.exports = class GunfightCommand extends Command {
|
||||
await msg.say(`TYPE \`${word.toUpperCase()}\` NOW!`);
|
||||
const filter = res => [opponent.id, msg.author.id].includes(res.author.id) && res.content.toLowerCase() === word;
|
||||
const now = Date.now();
|
||||
const winner = await msg.channel.awaitMessages(filter, {
|
||||
const winner = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -71,7 +71,8 @@ module.exports = class ImposterCommand extends Command {
|
||||
if (res.content && wordRegex.test(res.content)) return true;
|
||||
return false;
|
||||
};
|
||||
const msgs = await msg.channel.awaitMessages(filter, {
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 600000
|
||||
});
|
||||
@@ -119,7 +120,8 @@ module.exports = class ImposterCommand extends Command {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const vote = await msg.channel.awaitMessages(voteFilter, {
|
||||
const vote = await msg.channel.awaitMessages({
|
||||
filter: voteFilter,
|
||||
max: players.filter(player => !player.killed).size,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -82,7 +82,8 @@ module.exports = class IslandCommand extends Command {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const vote = await msg.channel.awaitMessages(voteFilter, {
|
||||
const vote = await msg.channel.awaitMessages({
|
||||
filter: voteFilter,
|
||||
max: playersLeft.size,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -65,7 +65,8 @@ module.exports = class JengaCommand extends Command {
|
||||
const j = Number.parseInt(choice, 10) - 1;
|
||||
return board[j];
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(pickFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: pickFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -76,7 +76,8 @@ module.exports = class LieSwatterCommand extends Command {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const msgs = await msg.channel.awaitMessages(filter, {
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: pts.size,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -71,7 +71,8 @@ module.exports = class NimCommand extends Command {
|
||||
const i = Number.parseInt(choice, 10) - 1;
|
||||
return board[i] && board[i] > 0;
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(pickFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: pickFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
@@ -110,7 +111,8 @@ module.exports = class NimCommand extends Command {
|
||||
const i = Number.parseInt(chosen, 10);
|
||||
return i <= row && i > 0;
|
||||
};
|
||||
const rowTurn = await msg.channel.awaitMessages(rowFilter, {
|
||||
const rowTurn = await msg.channel.awaitMessages({
|
||||
filter: rowFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -74,7 +74,8 @@ module.exports = class ObstructionCommand extends Command {
|
||||
if (!possibleMoves.includes(`${x - 1},${y - 1}`)) return false;
|
||||
return true;
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(turnFilter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter: turnFilter,
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
@@ -45,7 +45,8 @@ module.exports = class PickANumberCommand extends Command {
|
||||
if (!userTurn && num === player1Pick) return false;
|
||||
return num && nums.includes(num);
|
||||
};
|
||||
const player1 = await msg.channel.awaitMessages(filter, {
|
||||
const player1 = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
@@ -62,7 +63,8 @@ module.exports = class PickANumberCommand extends Command {
|
||||
} else {
|
||||
userTurn = false;
|
||||
await msg.say(`${opponent}, pick a number from 1 to 10, except ${player1Pick}.`);
|
||||
const player2 = await msg.channel.awaitMessages(filter, {
|
||||
const player2 = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -275,7 +275,7 @@ module.exports = class PokerCommand extends Command {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const msgs = await msg.channel.awaitMessages(filter, { max: 1, time: 60000 });
|
||||
const msgs = await msg.channel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
let choiceAction;
|
||||
if (msgs.size) {
|
||||
choiceAction = msgs.first().content.toLowerCase().replace(/[$,]/g, '');
|
||||
|
||||
@@ -69,7 +69,8 @@ module.exports = class QuizDuelCommand extends Command {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const msgs = await msg.channel.awaitMessages(filter, {
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: pts.size,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -37,7 +37,8 @@ module.exports = class SpamWarCommand extends Command {
|
||||
await msg.say('You get one point per character in your messages. You get 1 minute to spam.');
|
||||
await delay(5000);
|
||||
await msg.say('You have **1 minute** to spam. Go!');
|
||||
const msgs = await msg.channel.awaitMessages(res => [opponent.id, msg.author.id].includes(res.author.id), {
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter: res => [opponent.id, msg.author.id].includes(res.author.id),
|
||||
time: 60000
|
||||
});
|
||||
const authorMsgs = msgs
|
||||
|
||||
@@ -60,7 +60,8 @@ module.exports = class TicTacToeCommand extends Command {
|
||||
if (pick.toLowerCase() === 'end') return true;
|
||||
return sides.includes(pick) && !taken.includes(pick);
|
||||
};
|
||||
const turn = await msg.channel.awaitMessages(filter, {
|
||||
const turn = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -44,7 +44,8 @@ module.exports = class TypingRaceCommand extends Command {
|
||||
if (![opponent.id, msg.author.id].includes(res.author.id)) return false;
|
||||
return res.content.toLowerCase() === sentence;
|
||||
};
|
||||
const winner = await msg.channel.awaitMessages(filter, {
|
||||
const winner = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
@@ -72,7 +72,8 @@ module.exports = class WordChainCommand extends Command {
|
||||
await msg.say(`It's ${player}'s turn! The letter is **${letter}**.`);
|
||||
const filter = res =>
|
||||
res.author.id === player.id && /^[a-zA-Z']+$/i.test(res.content) && res.content.length < 50;
|
||||
const wordChoice = await msg.channel.awaitMessages(filter, {
|
||||
const wordChoice = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: time * 1000
|
||||
});
|
||||
|
||||
@@ -54,7 +54,8 @@ module.exports = class WordSpudCommand extends Command {
|
||||
_Type \`end\` to end the game._
|
||||
`);
|
||||
const filter = res => res.author.id === player.id && res.content.length <= 100;
|
||||
const msgs = await msg.channel.awaitMessages(filter, {
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user