Compare commits

..

No commits in common. "cc6dbe313b83dea86fda7cc48e7803226161e049" and "2becf6b95aa15c61a165d9b754a8bba259543f0a" have entirely different histories.

7 changed files with 1778 additions and 1175 deletions

45
.eslintrc.json Normal file
View file

@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"globals": {
"jest": true,
"require": true,
"exports": true,
"process": true
},
"ignorePatterns": [
"dist/**/*"
]
}

View file

@ -1,55 +0,0 @@
import js from "@eslint/js";
import ts from "typescript-eslint";
export default [
{
ignores: [
"**/dist/",
"eslint.config.mjs",
"jest.config.cjs",
"jest.setup.js",
"**/.temp/**/*"
],
},
js.configs.recommended,
...ts.configs.recommended,
{
languageOptions: {
globals: {
exports: "writable",
module: "writable",
require: "writable",
process: "writable",
console: "writable",
jest: "writable",
},
ecmaVersion: 6,
sourceType: "script",
},
files: [
"./src",
"./tests"
],
rules: {
camelcase: "error",
"brace-style": ["error", "1tbs"],
"comma-dangle": ["error", "never"],
"comma-spacing": ["error", {
before: false,
after: true,
}],
"comma-style": ["error", "last"],
"arrow-body-style": ["error", "as-needed"],
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"no-var": "error",
"prefer-template": "error",
"prefer-const": "error",
},
}
];

View file

@ -27,36 +27,37 @@
"dependencies": { "dependencies": {
"@discordjs/rest": "^2.0.0", "@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4", "@types/clone-deep": "^4.0.4",
"@types/express": "^5.0.0", "@types/express": "^4.17.20",
"@types/jest": "^29.5.14", "@types/jest": "^29.0.0",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"canvas": "^2.11.2", "canvas": "^2.11.2",
"clone-deep": "^4.0.1", "clone-deep": "^4.0.1",
"cron": "^3.1.7", "cron": "^3.1.7",
"discord.js": "^14.16.3", "discord.js": "^14.15.3",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"express": "^4.18.2", "express": "^4.18.2",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"jest": "^29.0.0", "jest": "^29.0.0",
"jest-mock-extended": "^3.0.0", "jest-mock-extended": "^3.0.0",
"jimp": "^1.6.0", "jimp": "^0.22.12",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"ts-jest": "^29.0.0", "ts-jest": "^29.0.0",
"typeorm": "0.3.20", "typeorm": "0.3.20",
"winston": "^3.15.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^5.0.0", "winston-daily-rotate-file": "^5.0.0",
"winston-discord-transport": "^1.3.0" "winston-discord-transport": "^1.3.0"
}, },
"resolutions": {}, "resolutions": {
"**/ws": "^8.17.1"
},
"devDependencies": { "devDependencies": {
"@types/node": "^22.8.1", "@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^8.11.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^8.11.0", "@typescript-eslint/parser": "^6.16.0",
"eslint": "^9.13.0", "eslint": "^8.56.0",
"np": "^10.0.7", "np": "^9.0.0",
"typescript": "^5.0.0", "typescript": "^5.0.0"
"typescript-eslint": "^8.11.0"
} }
} }

View file

@ -12,7 +12,6 @@ export default class Claim extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) { public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild || !interaction.guildId) return; if (!interaction.guild || !interaction.guildId) return;
if (!interaction.channel) return; if (!interaction.channel) return;
if (!interaction.channel.isSendable()) return;
await interaction.deferUpdate(); await interaction.deferUpdate();

View file

@ -3,7 +3,7 @@ import path from "path";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import {existsSync} from "fs"; import {existsSync} from "fs";
import Inventory from "../database/entities/app/Inventory"; import Inventory from "../database/entities/app/Inventory";
import {Jimp} from "jimp"; import Jimp from "jimp";
interface CardInput { interface CardInput {
id: string; id: string;
@ -46,7 +46,7 @@ export default class ImageHelper {
} }
} }
const image = await loadImage(await imageData.getBuffer("image/png")); const image = await loadImage(await imageData.getBufferAsync("image/png"));
const x = i % gridWidth; const x = i % gridWidth;
const y = Math.floor(i / gridWidth); const y = Math.floor(i / gridWidth);

View file

@ -1,63 +0,0 @@
describe("AddEffectToUserInventory", () => {
describe("GIVEN effect is in database", () => {
test.todo("EXPECT effect to be updated");
test.todo("EXPECT effect to be saved");
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT effect to be created");
test.todo("EXPECT effect to be saved");
});
});
describe("UseEffect", () => {
describe("GIVEN effect is in database", () => {
describe("GIVEN effect.WhenExpires is undefined", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN now is before effect.WhenExpires", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN currently used effect is inactive", () => {
test.todo("EXPECT UseEffect to be called");
test.todo("EXPECT effect to be saved");
test.todo("EXPECT true returned");
});
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN effect.Unused is 0", () => {
test.todo("EXPECT false returned");
});
});
describe("HasEffect", () => {
describe("GIVEN effect is in database", () => {
describe("GIVEN effect.WhenExpires is defined", () => {
describe("GIVEN now is before effect.WhenExpires", () => {
test.todo("EXPECT true returned");
});
describe("GIVEN now is after effect.WhenExpires", () => {
test.todo("EXPECT false returned");
});
});
describe("GIVEN effect.WhenExpires is undefined", () => {
test.todo("EXPECT false returned");
});
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT false returned");
});
});

2758
yarn.lock

File diff suppressed because it is too large Load diff