Tarot Command
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 253 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 50 KiB |
@@ -0,0 +1,62 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { escapeMarkdown } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { list, verify } = require('../../util/Util');
|
||||
const TarotDeck = require('../../structures/tarot/TarotDeck');
|
||||
const displayNums = ['first', 'second', 'final'];
|
||||
|
||||
module.exports = class TarotCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'tarot',
|
||||
aliases: ['tarot-reading'],
|
||||
group: 'games-sp',
|
||||
memberName: 'tarot',
|
||||
description: 'Provides a fortune using Tarot cards.',
|
||||
args: [
|
||||
{
|
||||
key: 'question',
|
||||
prompt: 'What question should the tarot reading answer?',
|
||||
type: 'string',
|
||||
max: 50
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { question }) {
|
||||
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.`);
|
||||
this.client.games.set(msg.channel.id, { name: this.name });
|
||||
try {
|
||||
const deck = new TarotDeck();
|
||||
const cards = deck.draw(3);
|
||||
for (let i = 0; i > cards.length; i++) {
|
||||
const card = cards[i];
|
||||
await msg.say(stripIndents`
|
||||
Your ${displayNums[i]} card is **${card.name}**.
|
||||
This card is often associated with words like **${list(card.keywords)}**.
|
||||
|
||||
One common meaning for this card is **${card.randomLightMeaning()}**.
|
||||
However, beware, as it could also mean **${card.randomShadowMeaning()}**.
|
||||
|
||||
Would you like me to keep going? Type **[y]es** or **[n]o**.
|
||||
`, { files: [card.imagePath] });
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) break;
|
||||
}
|
||||
this.client.games.delete(msg.channel.id);
|
||||
return msg.say(stripIndents`
|
||||
To finish with a recap, you asked the question: **${escapeMarkdown(question)}**
|
||||
|
||||
In response, the following cards were drawn:
|
||||
- ${cards.map(card => `${card.name} (${card.keywords.join(', ')})`).join('\n- ')}
|
||||
|
||||
I hope this gives you a good idea of what the future holds...
|
||||
`);
|
||||
} catch (err) {
|
||||
this.client.games.delete(msg.channel.id);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "134.14.0",
|
||||
"version": "134.15.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"private": true,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class TarotCard {
|
||||
constructor(data) {
|
||||
this.rank = data.rank;
|
||||
this.suit = data.suit;
|
||||
this.name = data.name;
|
||||
this.meanings = data.meanings;
|
||||
this.keywords = data.keywords;
|
||||
this.fortunes = data.fortune_telling;
|
||||
}
|
||||
|
||||
get imagePath() {
|
||||
return path.join(__dirname, '..', '..', 'assets', 'images', 'tarot', this.suit, `${this.rank}.jpg`);
|
||||
}
|
||||
|
||||
randomLightMeaning() {
|
||||
return this.meanings.light[Math.floor(Math.random() * this.meanings.light.length)];
|
||||
}
|
||||
|
||||
randomShadowMeaning() {
|
||||
return this.meanings.shadow[Math.floor(Math.random() * this.meanings.shadow.length)];
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const TarotCard = require('./TarotCard');
|
||||
const cards = require('../../assets/json/tarot');
|
||||
const { shuffle } = require('../../util/Util');
|
||||
|
||||
module.exports = class TarotDeck {
|
||||
constructor() {
|
||||
this.deck = [];
|
||||
this.makeCards();
|
||||
}
|
||||
|
||||
makeCards() {
|
||||
const newDeck = [];
|
||||
for (const card of cards) {
|
||||
newDeck.push(new TarotCard(card));
|
||||
}
|
||||
this.deck = shuffle(newDeck);
|
||||
return this.deck;
|
||||
}
|
||||
|
||||
draw(amount = 1) {
|
||||
const cards = [];
|
||||
for (let i = 0; i < amount; i++) {
|
||||
const card = this.deck[0];
|
||||
this.deck.shift();
|
||||
cards.push(card);
|
||||
}
|
||||
return amount === 1 ? cards[0] : cards;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.makeCards();
|
||||
return this;
|
||||
}
|
||||
};
|
||||