Tarot Command

This commit is contained in:
Dragon Fire
2021-04-11 14:24:13 -04:00
parent 7e91c2f66d
commit d785a38a05
83 changed files with 2711 additions and 1 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because it is too large Load Diff
+62
View File
@@ -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 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "134.14.0",
"version": "134.15.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"private": true,
+24
View File
@@ -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)];
}
};
+34
View File
@@ -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;
}
};