mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Remove CAH and A2A (on own bot)
This commit is contained in:
@@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
The bot is no longer available for invite. You can self-host the bot, or use her
|
||||
on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
## Commands (302)
|
||||
## Commands (300)
|
||||
### Utility:
|
||||
|
||||
* **eval**: Executes JavaScript code.
|
||||
@@ -195,12 +195,10 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
### Games:
|
||||
|
||||
* **akinator**: Think about a real or fictional character, I will try to guess who it is.
|
||||
* **apples-to-apples**: Compete to see who can come up with the best card to match an adjective.
|
||||
* **balloon-pop**: Don't let yourself be the last one to pump the balloon before it pops!
|
||||
* **battle**: Engage in a turn-based battle against another user or the AI.
|
||||
* **box-choosing**: Do you believe that there are choices in life? Taken from Higurashi Chapter 4.
|
||||
* **captcha-quiz**: Try to guess what the captcha says.
|
||||
* **cards-against-humanity**: Compete to see who can come up with the best card to fill in the blank.
|
||||
* **chance**: Attempt to win with a 1 in 1000 (or your choice) chance of winning.
|
||||
* **emoji-emoji-revolution**: Can you type arrow emoji faster than anyone else has ever typed them before?
|
||||
* **fishy**: Go fishing.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,263 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { Collection, escapeMarkdown } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { shuffle, awaitPlayers } = require('../../util/Util');
|
||||
const { greenCards, redCards } = require('../../assets/json/apples-to-apples');
|
||||
const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env;
|
||||
|
||||
module.exports = class ApplesToApplesCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'apples-to-apples',
|
||||
group: 'games',
|
||||
memberName: 'apples-to-apples',
|
||||
description: 'Compete to see who can come up with the best card to match an adjective.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'maxPts',
|
||||
label: 'maximum amount of points',
|
||||
prompt: 'What amount of points should determine the winner?',
|
||||
type: 'integer',
|
||||
min: 1,
|
||||
max: 20
|
||||
},
|
||||
{
|
||||
key: 'noMidJoin',
|
||||
label: 'disable mid-game join',
|
||||
prompt: 'Do you want to disable mid-game joining?',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.playing = new Set();
|
||||
}
|
||||
|
||||
async run(msg, { maxPts, noMidJoin }) { // eslint-disable-line complexity
|
||||
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
|
||||
this.playing.add(msg.channel.id);
|
||||
let joinLeaveCollector = null;
|
||||
let pointViewCollector = null;
|
||||
try {
|
||||
await msg.say('You will need at least 2 more players, at maximum 10. To join, type `join game`.');
|
||||
const awaitedPlayers = await awaitPlayers(msg, 10, 3);
|
||||
if (!awaitedPlayers) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
return msg.say('Game could not be started...');
|
||||
}
|
||||
const players = new Collection();
|
||||
for (const user of awaitedPlayers) this.generatePlayer(user, players);
|
||||
const czars = players.map(player => player.id);
|
||||
let winner = null;
|
||||
if (!noMidJoin) joinLeaveCollector = this.createJoinLeaveCollector(msg.channel, players, czars);
|
||||
pointViewCollector = this.createPointViewCollector(msg.channel, players);
|
||||
while (!winner) {
|
||||
for (const player of players) {
|
||||
if (player.strikes >= 3) this.kickPlayer(player, players, czars);
|
||||
}
|
||||
if (players.size < 3) {
|
||||
await msg.say('Oh... It looks like everyone left...');
|
||||
break;
|
||||
}
|
||||
const czar = players.get(czars[0]);
|
||||
czars.push(czar.id);
|
||||
czars.shift();
|
||||
const green = greenCards[Math.floor(Math.random() * greenCards.length)];
|
||||
await msg.say(stripIndents`
|
||||
The card czar will be ${czar.user}!
|
||||
The Green Card is: **${escapeMarkdown(green)}**
|
||||
|
||||
Sending DMs...
|
||||
`);
|
||||
const chosenCards = [];
|
||||
await Promise.all(players.map(player => this.playerTurn(player, czar, green, msg.channel, chosenCards)));
|
||||
if (!chosenCards.length) {
|
||||
await msg.say('Hmm... No one even tried.');
|
||||
continue;
|
||||
}
|
||||
const cards = shuffle(chosenCards);
|
||||
await msg.say(stripIndents`
|
||||
${czar.user}, which card do you pick?
|
||||
**Green Card**: ${escapeMarkdown(green)}
|
||||
|
||||
${cards.map((card, i) => `**${i + 1}.** ${card.card}`).join('\n')}
|
||||
`);
|
||||
const filter = res => {
|
||||
if (res.author.id !== czar.user.id) return false;
|
||||
if (!/^[0-9]+$/g.test(res.content)) return false;
|
||||
if (!cards[Number.parseInt(res.content, 10) - 1]) return false;
|
||||
return true;
|
||||
};
|
||||
const chosen = await msg.channel.awaitMessages(filter, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
if (!chosen.size) {
|
||||
await msg.say('Hmm... No one wins. Dealing back cards...');
|
||||
for (const pick of cards) players.get(pick.id).hand.add(pick.card);
|
||||
players.get(czar.id).strikes++;
|
||||
continue;
|
||||
}
|
||||
const player = players.get(cards[Number.parseInt(chosen.first().content, 10) - 1].id);
|
||||
if (!player) {
|
||||
await msg.say('Oh no, I think that player left! No points will be awarded...');
|
||||
continue;
|
||||
}
|
||||
++player.points;
|
||||
if (player.points >= maxPts) {
|
||||
winner = player.user;
|
||||
} else {
|
||||
const addS = player.points > 1 ? 's' : '';
|
||||
await msg.say(`Nice, ${player.user}! You now have **${player.points}** point${addS}!`);
|
||||
}
|
||||
}
|
||||
if (joinLeaveCollector) joinLeaveCollector.stop();
|
||||
pointViewCollector.stop();
|
||||
this.playing.delete(msg.channel.id);
|
||||
if (!winner) return msg.say('See you next time!');
|
||||
return msg.say(`And the winner is... ${winner}! Great job!`);
|
||||
} catch (err) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
if (joinLeaveCollector) joinLeaveCollector.stop();
|
||||
if (pointViewCollector) pointViewCollector.stop();
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
generatePlayer(user, players) {
|
||||
const cards = new Set();
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const valid = redCards.filter(card => !cards.has(card));
|
||||
cards.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
players.set(user.id, {
|
||||
id: user.id,
|
||||
user,
|
||||
points: 0,
|
||||
hand: cards,
|
||||
strikes: 0
|
||||
});
|
||||
return players;
|
||||
}
|
||||
|
||||
async playerTurn(player, czar, green, channel, chosenCards) {
|
||||
if (player.user.id === czar.user.id) return;
|
||||
if (player.hand.size < 10) {
|
||||
const valid = redCards.filter(card => !player.hand.has(card));
|
||||
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
try {
|
||||
if (player.hand.size < 1) {
|
||||
await player.user.send('You don\'t have enough cards!');
|
||||
return;
|
||||
}
|
||||
const hand = Array.from(player.hand);
|
||||
await player.user.send(stripIndents`
|
||||
__**Your hand is**__: _(Type \`swap\` to exchange a point for a new hand.)_
|
||||
${hand.map((card, i) => `**${i + 1}.** ${card}`).join('\n')}
|
||||
|
||||
**Green Card**: ${escapeMarkdown(green)}
|
||||
**Card Czar**: ${czar.user.username}
|
||||
Pick **1** card!
|
||||
`);
|
||||
let chosen = null;
|
||||
const filter = res => {
|
||||
if (res.content.toLowerCase() === 'swap' && player.points > 0) return true;
|
||||
const existing = hand[Number.parseInt(res.content, 10) - 1];
|
||||
if (!existing) return false;
|
||||
chosen = existing;
|
||||
return true;
|
||||
};
|
||||
const choices = await player.user.dmChannel.awaitMessages(filter, {
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
if (choices.first().content.toLowerCase() === 'swap') {
|
||||
player.points--;
|
||||
await player.user.send('Swapping cards...');
|
||||
for (const card of player.hand) player.hand.delete(card);
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const valid = redCards.filter(card => !player.hand.has(card));
|
||||
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
return this.playerTurn(player, czar, green, channel, chosenCards); // eslint-disable-line consistent-return
|
||||
}
|
||||
if (choices.size < 1) {
|
||||
chosen = hand[Math.floor(Math.random() * hand.length)];
|
||||
player.strikes++;
|
||||
}
|
||||
if (chosen === '<Blank>') {
|
||||
if (choices.size < 1) {
|
||||
const handled = await this.handleBlank(player);
|
||||
chosen = handled;
|
||||
} else {
|
||||
chosen = 'A randomly chosen blank card.';
|
||||
}
|
||||
}
|
||||
player.hand.delete(chosen);
|
||||
chosenCards.push({
|
||||
id: player.id,
|
||||
card: chosen
|
||||
});
|
||||
await player.user.send(`Nice! Return to ${channel} to await the results!`);
|
||||
} catch (err) {
|
||||
return; // eslint-disable-line no-useless-return
|
||||
}
|
||||
}
|
||||
|
||||
async handleBlank(player) {
|
||||
await player.user.send('What do you want the blank card to say? Must be 100 or less characters.');
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length <= 100, {
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
player.hand.delete('<Blank>');
|
||||
if (!blank.size) return `A blank card ${player.user.tag} forgot to fill out.`;
|
||||
return blank.first().content;
|
||||
}
|
||||
|
||||
createJoinLeaveCollector(channel, players, czars) {
|
||||
const filter = res => {
|
||||
if (res.author.bot) return false;
|
||||
if (players.has(res.author.id) && res.content.toLowerCase() !== 'leave game') return false;
|
||||
if (czars[0] === res.author.id || players.size >= 10) {
|
||||
res.react(FAILURE_EMOJI_ID || '❌').catch(() => null);
|
||||
return false;
|
||||
}
|
||||
if (!['join game', 'leave game'].includes(res.content.toLowerCase())) return false;
|
||||
res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null);
|
||||
return true;
|
||||
};
|
||||
const collector = channel.createMessageCollector(filter);
|
||||
collector.on('collect', msg => {
|
||||
if (msg.content.toLowerCase() === 'join game') {
|
||||
this.generatePlayer(msg.author, players);
|
||||
czars.push(msg.author.id);
|
||||
} else if (msg.content.toLowerCase() === 'leave game') {
|
||||
this.kickPlayer(msg.author, players, czars);
|
||||
}
|
||||
});
|
||||
return collector;
|
||||
}
|
||||
|
||||
createPointViewCollector(channel, players) {
|
||||
const collector = channel.createMessageCollector(res => {
|
||||
if (res.author.bot) return false;
|
||||
if (!players.has(res.author.id)) return false;
|
||||
if (res.content.toLowerCase() !== 'view points') return false;
|
||||
return true;
|
||||
});
|
||||
collector.on('collect', msg => {
|
||||
const player = players.get(msg.author.id);
|
||||
msg.reply(`You have **${player.points}** point${player.points > 1 ? 's' : ''}.`).catch(() => null);
|
||||
});
|
||||
return collector;
|
||||
}
|
||||
|
||||
kickPlayer(player, players, czars) {
|
||||
players.delete(player.id);
|
||||
czars.splice(czars.indexOf(player.id), 1);
|
||||
}
|
||||
};
|
||||
@@ -1,267 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { Collection, escapeMarkdown } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { shuffle, awaitPlayers } = require('../../util/Util');
|
||||
const { blackCards, whiteCards } = require('../../assets/json/cards-against-humanity');
|
||||
const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env;
|
||||
|
||||
module.exports = class CardsAgainstHumanityCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cards-against-humanity',
|
||||
aliases: ['crude-cards', 'pretend-youre-xyzzy', 'cah'],
|
||||
group: 'games',
|
||||
memberName: 'cards-against-humanity',
|
||||
description: 'Compete to see who can come up with the best card to fill in the blank.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'maxPts',
|
||||
label: 'maximum amount of points',
|
||||
prompt: 'What amount of points should determine the winner?',
|
||||
type: 'integer',
|
||||
min: 1,
|
||||
max: 20
|
||||
},
|
||||
{
|
||||
key: 'noMidJoin',
|
||||
label: 'disable mid-game join',
|
||||
prompt: 'Do you want to disable mid-game joining?',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.playing = new Set();
|
||||
}
|
||||
|
||||
async run(msg, { maxPts, noMidJoin }) { // eslint-disable-line complexity
|
||||
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
|
||||
this.playing.add(msg.channel.id);
|
||||
let joinLeaveCollector = null;
|
||||
let pointViewCollector = null;
|
||||
try {
|
||||
await msg.say('You will need at least 2 more players, at maximum 10. To join, type `join game`.');
|
||||
const awaitedPlayers = await awaitPlayers(msg, 10, 3);
|
||||
if (!awaitedPlayers) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
return msg.say('Game could not be started...');
|
||||
}
|
||||
const players = new Collection();
|
||||
for (const user of awaitedPlayers) this.generatePlayer(user, players);
|
||||
const czars = players.map(player => player.id);
|
||||
let winner = null;
|
||||
if (!noMidJoin) joinLeaveCollector = this.createJoinLeaveCollector(msg.channel, players, czars);
|
||||
pointViewCollector = this.createPointViewCollector(msg.channel, players);
|
||||
while (!winner) {
|
||||
for (const player of players) {
|
||||
if (player.strikes >= 3) this.kickPlayer(player, players, czars);
|
||||
}
|
||||
if (players.size < 3) {
|
||||
await msg.say('Oh... It looks like everyone left...');
|
||||
break;
|
||||
}
|
||||
const czar = players.get(czars[0]);
|
||||
czars.push(czar.id);
|
||||
czars.shift();
|
||||
const black = blackCards[Math.floor(Math.random() * blackCards.length)];
|
||||
await msg.say(stripIndents`
|
||||
The card czar will be ${czar.user}!
|
||||
The Black Card is: **${escapeMarkdown(black.text)}**
|
||||
|
||||
Sending DMs...
|
||||
`);
|
||||
const chosenCards = [];
|
||||
await Promise.all(players.map(player => this.playerTurn(player, czar, black, msg.channel, chosenCards)));
|
||||
if (!chosenCards.length) {
|
||||
await msg.say('Hmm... No one even tried.');
|
||||
continue;
|
||||
}
|
||||
const cards = shuffle(chosenCards);
|
||||
await msg.say(stripIndents`
|
||||
${czar.user}, which card${black.pick > 1 ? 's' : ''} do you pick?
|
||||
**Black Card**: ${escapeMarkdown(black.text)}
|
||||
|
||||
${cards.map((card, i) => `**${i + 1}.** ${card.cards.join(', ')}`).join('\n')}
|
||||
`);
|
||||
const filter = res => {
|
||||
if (res.author.id !== czar.user.id) return false;
|
||||
if (!/^[0-9]+$/g.test(res.content)) return false;
|
||||
if (!cards[Number.parseInt(res.content, 10) - 1]) return false;
|
||||
return true;
|
||||
};
|
||||
const chosen = await msg.channel.awaitMessages(filter, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
if (!chosen.size) {
|
||||
await msg.say('Hmm... No one wins. Dealing back cards...');
|
||||
for (const pick of cards) {
|
||||
for (const card of pick.cards) players.get(pick.id).hand.add(card);
|
||||
}
|
||||
players.get(czar.id).strikes++;
|
||||
continue;
|
||||
}
|
||||
const player = players.get(cards[Number.parseInt(chosen.first().content, 10) - 1].id);
|
||||
if (!player) {
|
||||
await msg.say('Oh no, I think that player left! No points will be awarded...');
|
||||
continue;
|
||||
}
|
||||
++player.points;
|
||||
if (player.points >= maxPts) {
|
||||
winner = player.user;
|
||||
} else {
|
||||
const addS = player.points > 1 ? 's' : '';
|
||||
await msg.say(`Nice, ${player.user}! You now have **${player.points}** point${addS}!`);
|
||||
}
|
||||
}
|
||||
if (joinLeaveCollector) joinLeaveCollector.stop();
|
||||
pointViewCollector.stop();
|
||||
this.playing.delete(msg.channel.id);
|
||||
if (!winner) return msg.say('See you next time!');
|
||||
return msg.say(`And the winner is... ${winner}! Great job!`);
|
||||
} catch (err) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
if (joinLeaveCollector) joinLeaveCollector.stop();
|
||||
if (pointViewCollector) pointViewCollector.stop();
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
generatePlayer(user, players) {
|
||||
const cards = new Set();
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const valid = whiteCards.filter(card => !cards.has(card));
|
||||
cards.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
players.set(user.id, {
|
||||
id: user.id,
|
||||
user,
|
||||
points: 0,
|
||||
hand: cards,
|
||||
strikes: 0
|
||||
});
|
||||
return players;
|
||||
}
|
||||
|
||||
async playerTurn(player, czar, black, channel, chosenCards) {
|
||||
if (player.user.id === czar.user.id) return;
|
||||
if (player.hand.size < 10) {
|
||||
const valid = whiteCards.filter(card => !player.hand.has(card));
|
||||
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
try {
|
||||
if (player.hand.size < black.pick) {
|
||||
await player.user.send('You don\'t have enough cards!');
|
||||
return;
|
||||
}
|
||||
const hand = Array.from(player.hand);
|
||||
await player.user.send(stripIndents`
|
||||
__**Your hand is**__: _(Type \`swap\` to exchange a point for a new hand.)_
|
||||
${hand.map((card, i) => `**${i + 1}.** ${card}`).join('\n')}
|
||||
|
||||
**Black Card**: ${escapeMarkdown(black.text)}
|
||||
**Card Czar**: ${czar.user.username}
|
||||
Pick **${black.pick}** card${black.pick > 1 ? 's' : ''}!
|
||||
`);
|
||||
const chosen = [];
|
||||
const filter = res => {
|
||||
if (res.content.toLowerCase() === 'swap' && player.points > 0) return true;
|
||||
const existing = hand[Number.parseInt(res.content, 10) - 1];
|
||||
if (!existing) return false;
|
||||
if (chosen.includes(existing)) return false;
|
||||
chosen.push(existing);
|
||||
return true;
|
||||
};
|
||||
const choices = await player.user.dmChannel.awaitMessages(filter, {
|
||||
max: black.pick,
|
||||
time: 60000
|
||||
});
|
||||
if (choices.first().content.toLowerCase() === 'swap') {
|
||||
player.points--;
|
||||
await player.user.send('Swapping cards...');
|
||||
for (const card of player.hand) player.hand.delete(card);
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const valid = whiteCards.filter(card => !player.hand.has(card));
|
||||
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
|
||||
}
|
||||
return this.playerTurn(player, czar, black, channel, chosenCards); // eslint-disable-line consistent-return
|
||||
}
|
||||
if (choices.size < black.pick) {
|
||||
for (let i = 0; i < black.pick; i++) chosen.push(hand[Math.floor(Math.random() * hand.length)]);
|
||||
player.strikes++;
|
||||
}
|
||||
if (chosen.includes('<Blank>')) {
|
||||
if (choices.size < black.pick) {
|
||||
const handled = await this.handleBlank(player);
|
||||
chosen[chosen.indexOf('<Blank>')] = handled;
|
||||
} else {
|
||||
chosen[chosen.indexOf('<Blank>')] = 'A randomly chosen blank card.';
|
||||
}
|
||||
}
|
||||
for (const card of chosen) player.hand.delete(card);
|
||||
chosenCards.push({
|
||||
id: player.id,
|
||||
cards: chosen
|
||||
});
|
||||
await player.user.send(`Nice! Return to ${channel} to await the results!`);
|
||||
} catch (err) {
|
||||
return; // eslint-disable-line no-useless-return
|
||||
}
|
||||
}
|
||||
|
||||
async handleBlank(player) {
|
||||
await player.user.send('What do you want the blank card to say? Must be 100 or less characters.');
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length <= 100, {
|
||||
max: 1,
|
||||
time: 60000
|
||||
});
|
||||
player.hand.delete('<Blank>');
|
||||
if (!blank.size) return `A blank card ${player.user.tag} forgot to fill out.`;
|
||||
return blank.first().content;
|
||||
}
|
||||
|
||||
createJoinLeaveCollector(channel, players, czars) {
|
||||
const filter = res => {
|
||||
if (res.author.bot) return false;
|
||||
if (players.has(res.author.id) && res.content.toLowerCase() !== 'leave game') return false;
|
||||
if (czars[0] === res.author.id || players.size >= 10) {
|
||||
res.react(FAILURE_EMOJI_ID || '❌').catch(() => null);
|
||||
return false;
|
||||
}
|
||||
if (!['join game', 'leave game'].includes(res.content.toLowerCase())) return false;
|
||||
res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null);
|
||||
return true;
|
||||
};
|
||||
const collector = channel.createMessageCollector(filter);
|
||||
collector.on('collect', msg => {
|
||||
if (msg.content.toLowerCase() === 'join game') {
|
||||
this.generatePlayer(msg.author, players);
|
||||
czars.push(msg.author.id);
|
||||
} else if (msg.content.toLowerCase() === 'leave game') {
|
||||
this.kickPlayer(msg.author, players, czars);
|
||||
}
|
||||
});
|
||||
return collector;
|
||||
}
|
||||
|
||||
createPointViewCollector(channel, players) {
|
||||
const collector = channel.createMessageCollector(res => {
|
||||
if (res.author.bot) return false;
|
||||
if (!players.has(res.author.id)) return false;
|
||||
if (res.content.toLowerCase() !== 'view points') return false;
|
||||
return true;
|
||||
});
|
||||
collector.on('collect', msg => {
|
||||
const player = players.get(msg.author.id);
|
||||
msg.reply(`You have **${player.points}** point${player.points > 1 ? 's' : ''}.`).catch(() => null);
|
||||
});
|
||||
return collector;
|
||||
}
|
||||
|
||||
kickPlayer(player, players, czars) {
|
||||
players.delete(player.id);
|
||||
czars.splice(czars.indexOf(player.id), 1);
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "85.12.5",
|
||||
"version": "86.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user