mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Prevent blacklisted users from playing games
This commit is contained in:
@@ -34,7 +34,7 @@ module.exports = class BalloonPopCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, playersCount, 2);
|
const awaitedPlayers = await awaitPlayers(msg, playersCount, 2, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ module.exports = class BattleCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not battle yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not battle yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 Battle(msg.author, opponent) });
|
this.client.games.set(msg.channel.id, { name: this.name, data: new Battle(msg.author, opponent) });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = class BingoCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, playersCount);
|
const awaitedPlayers = await awaitPlayers(msg, playersCount, 1, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ module.exports = class CarRaceCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent, car }) {
|
async run(msg, { opponent, car }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ module.exports = class ChessCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent, time, fen }) {
|
async run(msg, { opponent, time, fen }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ module.exports = class ConnectFourCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent, color }) {
|
async run(msg, { opponent, color }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ module.exports = class CramCommand extends Command {
|
|||||||
async run(msg, { opponent, color, size }) {
|
async run(msg, { opponent, color, size }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ module.exports = class DomineeringCommand extends Command {
|
|||||||
async run(msg, { opponent, color, size }) {
|
async run(msg, { opponent, color, size }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ module.exports = class DotsAndBoxesCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ module.exports = class EmojiEmojiRevolutionCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ module.exports = class GuesspionageCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, players, min);
|
const awaitedPlayers = await awaitPlayers(msg, players, min, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ module.exports = class GunfightCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be fought.');
|
if (opponent.bot) return msg.reply('Bots may not be fought.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not fight yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not fight yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class ImposterCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, playersCount, 3);
|
const awaitedPlayers = await awaitPlayers(msg, playersCount, 3, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module.exports = class IslandCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, playersCount, 3);
|
const awaitedPlayers = await awaitPlayers(msg, playersCount, 3, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ module.exports = class JengaCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class LieSwatterCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, players);
|
const awaitedPlayers = await awaitPlayers(msg, players, 1, this.client.blacklist.user);
|
||||||
let turn = 0;
|
let turn = 0;
|
||||||
const pts = new Collection();
|
const pts = new Collection();
|
||||||
for (const player of awaitedPlayers) {
|
for (const player of awaitedPlayers) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module.exports = class NimCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent, rows }) {
|
async run(msg, { opponent, rows }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ module.exports = class ObstructionCommand extends Command {
|
|||||||
async run(msg, { opponent, size }) {
|
async run(msg, { opponent, size }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ module.exports = class PickANumberCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = class PokerCommand extends Command {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, playersCount, min);
|
const awaitedPlayers = await awaitPlayers(msg, playersCount, min, this.client.blacklist.user);
|
||||||
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...');
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports = class QuizDuelCommand extends Command {
|
|||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
try {
|
try {
|
||||||
const awaitedPlayers = await awaitPlayers(msg, players);
|
const awaitedPlayers = await awaitPlayers(msg, players, 1, this.client.blacklist.user);
|
||||||
let turn = 0;
|
let turn = 0;
|
||||||
const pts = new Collection();
|
const pts = new Collection();
|
||||||
for (const player of awaitedPlayers) {
|
for (const player of awaitedPlayers) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ module.exports = class RussianRouletteCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not challenge yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not challenge yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = class SpamWarCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ module.exports = class TicTacToeCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = class TypingRaceCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ module.exports = class WordChainCommand extends Command {
|
|||||||
async run(msg, { opponent, time }) {
|
async run(msg, { opponent, time }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ module.exports = class WordSpudCommand extends Command {
|
|||||||
async run(msg, { opponent }) {
|
async run(msg, { opponent }) {
|
||||||
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
if (opponent.bot) return msg.reply('Bots may not be played against.');
|
||||||
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
|
||||||
|
if (this.client.blacklist.user.includes(opponent.id)) return msg.reply('This user is blacklisted.');
|
||||||
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 });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "129.7.2",
|
"version": "129.7.3",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+2
-1
@@ -253,7 +253,7 @@ module.exports = class Util {
|
|||||||
return arr[Number.parseInt(msgs.first().content, 10) - 1];
|
return arr[Number.parseInt(msgs.first().content, 10) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static async awaitPlayers(msg, max, min = 1) {
|
static async awaitPlayers(msg, max, min, blacklist) {
|
||||||
if (max === 1) return [msg.author.id];
|
if (max === 1) return [msg.author.id];
|
||||||
const addS = min - 1 === 1 ? '' : 's';
|
const addS = min - 1 === 1 ? '' : 's';
|
||||||
await msg.say(
|
await msg.say(
|
||||||
@@ -263,6 +263,7 @@ module.exports = class Util {
|
|||||||
joined.push(msg.author.id);
|
joined.push(msg.author.id);
|
||||||
const filter = res => {
|
const filter = res => {
|
||||||
if (res.author.bot) return false;
|
if (res.author.bot) return false;
|
||||||
|
if (blacklist.includes(res.author.id)) return false;
|
||||||
if (joined.includes(res.author.id)) return false;
|
if (joined.includes(res.author.id)) return false;
|
||||||
if (res.content.toLowerCase() !== 'join game') return false;
|
if (res.content.toLowerCase() !== 'join game') return false;
|
||||||
joined.push(res.author.id);
|
joined.push(res.author.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user