Compare commits

..

1 commit

Author SHA1 Message Date
75bdf5b95d Update dependency @types/node to v20.8.6
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-15 23:01:21 +00:00
6 changed files with 549 additions and 601 deletions

3
.gitignore vendored
View file

@ -107,5 +107,4 @@ config.json
.DS_Store
ormconfig.json
gdrive-credentials.json
cards/
*.db
cards/

View file

@ -1,6 +1,6 @@
{
"name": "card-drop",
"version": "0.1.6",
"version": "0.1.5",
"main": "./dist/bot.js",
"typings": "./dist",
"scripts": {
@ -28,7 +28,7 @@
"@types/uuid": "^9.0.0",
"discord.js": "^14.3.0",
"dotenv": "^16.0.0",
"googleapis": "^127.0.0",
"googleapis": "^126.0.0",
"jest": "^29.0.0",
"jest-mock-extended": "^3.0.0",
"minimatch": "9.0.3",

View file

@ -59,7 +59,7 @@ export default class CardSetupFunction {
const cardDirLegendary = legendaryExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'LEGENDARY')) : [];
const cardDirSilver = silverExists ? readdirSync(path.join(process.cwd(), 'cards', series.Path, 'SILVER')) : [];
for (let file of cardDirBronze.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
for (let file of cardDirBronze) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -70,7 +70,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirGold.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
for (let file of cardDirGold) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -81,7 +81,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirLegendary.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
for (let file of cardDirLegendary) {
const filePart = file.split('.');
const cardId = filePart[0];
@ -92,7 +92,7 @@ export default class CardSetupFunction {
cardsToSave.push(card);
}
for (let file of cardDirSilver.filter(x => !x.startsWith('.') && (x.endsWith('.png') || x.endsWith('.jpg') || x.endsWith('.gif')))) {
for (let file of cardDirSilver) {
const filePart = file.split('.');
const cardId = filePart[0];

View file

@ -6,7 +6,6 @@ import { CardRarityToColour, CardRarityToString } from "../constants/CardRarity"
import { v4 } from "uuid";
import { CoreClient } from "../client/client";
import Card from "../database/entities/card/Card";
import Inventory from "../database/entities/app/Inventory";
export default class Reroll extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
@ -33,16 +32,9 @@ export default class Reroll extends ButtonEvent {
const attachment = new AttachmentBuilder(image, { name: randomCard.FileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.CardNumber);
const quantityClaimed = inventory ? inventory.Quantity : 0;
let embedDescription = "";
embedDescription += `Series: ${randomCard.Series.Name}\n`;
embedDescription += `Claimed: ${quantityClaimed || 0}\n`;
const embed = new EmbedBuilder()
.setTitle(randomCard.Name)
.setDescription(embedDescription)
.setDescription(randomCard.Series.Name)
.setFooter({ text: CardRarityToString(randomCard.Rarity) })
.setColor(CardRarityToColour(randomCard.Rarity))
.setImage(`attachment://${randomCard.FileName}`);

View file

@ -6,7 +6,6 @@ import { readFileSync } from "fs";
import { CoreClient } from "../client/client";
import { v4 } from "uuid";
import Card from "../database/entities/card/Card";
import Inventory from "../database/entities/app/Inventory";
export default class Drop extends Command {
constructor() {
@ -39,16 +38,9 @@ export default class Drop extends Command {
const attachment = new AttachmentBuilder(image, { name: randomCard.FileName });
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.CardNumber);
const quantityClaimed = inventory ? inventory.Quantity : 0;
let embedDescription = "";
embedDescription += `Series: ${randomCard.Series.Name}\n`;
embedDescription += `Claimed: ${quantityClaimed || 0}\n`;
const embed = new EmbedBuilder()
.setTitle(randomCard.Name)
.setDescription(embedDescription)
.setDescription(randomCard.Series.Name)
.setFooter({ text: CardRarityToString(randomCard.Rarity) })
.setColor(CardRarityToColour(randomCard.Rarity))
.setImage(`attachment://${randomCard.FileName}`);

1115
yarn.lock

File diff suppressed because it is too large Load diff