Compare commits

..

No commits in common. "664d3d1888005e74a2fc8c95ec5649b7696134e9" and "36ec25113edd6da2775da573425e4de513b2af09" have entirely different histories.

5 changed files with 5 additions and 85 deletions

58
package-lock.json generated
View file

@ -10,12 +10,10 @@
"license": "MIT",
"dependencies": {
"@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4",
"@types/express": "^4.17.20",
"@types/jest": "^29.0.0",
"@types/uuid": "^9.0.0",
"body-parser": "^1.20.2",
"clone-deep": "^4.0.1",
"discord.js": "^14.3.0",
"dotenv": "^16.0.0",
"express": "^4.18.2",
@ -1787,11 +1785,6 @@
"@types/responselike": "^1.0.0"
}
},
"node_modules/@types/clone-deep": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz",
"integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA=="
},
"node_modules/@types/connect": {
"version": "3.4.38",
"license": "MIT",
@ -3795,19 +3788,6 @@
"node": ">=0.8"
}
},
"node_modules/clone-deep": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
"integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
"dependencies": {
"is-plain-object": "^2.0.4",
"kind-of": "^6.0.2",
"shallow-clone": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/clone-response": {
"version": "1.0.3",
"dev": true,
@ -6445,17 +6425,6 @@
"node": ">=8"
}
},
"node_modules/is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
"dependencies": {
"isobject": "^3.0.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-promise": {
"version": "2.2.2",
"dev": true,
@ -6531,14 +6500,6 @@
"version": "2.0.0",
"license": "ISC"
},
"node_modules/isobject": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/issue-regex": {
"version": "4.1.0",
"dev": true,
@ -7339,14 +7300,6 @@
"json-buffer": "3.0.1"
}
},
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/kleur": {
"version": "3.0.3",
"license": "MIT",
@ -10288,17 +10241,6 @@
"sha.js": "bin.js"
}
},
"node_modules/shallow-clone": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
"integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
"dependencies": {
"kind-of": "^6.0.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"license": "MIT",

View file

@ -26,12 +26,10 @@
"funding": "https://ko-fi.com/vylpes",
"dependencies": {
"@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4",
"@types/express": "^4.17.20",
"@types/jest": "^29.0.0",
"@types/uuid": "^9.0.0",
"body-parser": "^1.20.2",
"clone-deep": "^4.0.1",
"discord.js": "^14.3.0",
"dotenv": "^16.0.0",
"express": "^4.18.2",

View file

@ -4,28 +4,17 @@ import InventoryHelper from "../helpers/InventoryHelper";
export default class Inventory extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild) return;
const userid = interaction.customId.split(" ")[1];
const page = interaction.customId.split(" ")[2];
const member = interaction.guild.members.cache.find(x => x.id == userid) || await interaction.guild.members.fetch(userid);
if (!member) {
await interaction.reply("Unable to find user.");
return;
}
try {
const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page));
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, userid, Number(page));
await interaction.update({
content: `${member.user.username} - ${member.user.id}`,
embeds: [ embed.embed ],
components: [ embed.row ],
});
} catch (e) {
console.error(e);
} catch {
await interaction.reply("No page for user found.");
}
}

View file

@ -12,16 +12,11 @@ export default class Inventory extends Command {
.addNumberOption(x =>
x
.setName("page")
.setDescription("The page to start with"))
.addUserOption(x =>
x
.setName("user")
.setDescription("The user to view (Defaults to yourself)"));
.setDescription("The page to start with"));
}
public override async execute(interaction: CommandInteraction) {
const page = interaction.options.get("page");
const user = interaction.options.getUser("user") || interaction.user;
try {
let pageNumber = 0;
@ -30,10 +25,9 @@ export default class Inventory extends Command {
pageNumber = Number(page.value) - 1;
}
const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber);
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, pageNumber);
await interaction.reply({
content: `${user.username} - ${user.id}`,
embeds: [ embed.embed ],
components: [ embed.row ],
});

View file

@ -3,7 +3,6 @@ import Inventory from "../database/entities/app/Inventory";
import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours";
import { CardRarity, CardRarityToString } from "../constants/CardRarity";
import cloneDeep from "clone-deep";
interface InventoryPage {
id: number,
@ -25,9 +24,7 @@ export default class InventoryHelper {
const inventory = await Inventory.FetchAllByUserId(userid);
const clientCards = cloneDeep(CoreClient.Cards);
const allSeriesClaimed = clientCards
const allSeriesClaimed = CoreClient.Cards
.sort((a, b) => a.id - b.id)
.filter(x => {
x.cards = x.cards