Create inventory command

This commit is contained in:
Ethan Lane 2023-12-20 18:33:07 +00:00
parent b667f1ffb9
commit 95ed90b916
3 changed files with 9 additions and 5 deletions

View file

@ -84,11 +84,7 @@ export class CoreClient extends Client {
console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`); console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`);
console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).join(", ")}`); console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).join(", ")}`);
const page = await InventoryHelper.GenerateInventoryPage('125776189666230272', 0); await super.login(process.env.BOT_TOKEN);
console.log(page);
// await super.login(process.env.BOT_TOKEN);
} }
public static RegisterCommand(name: string, command: Command, environment: Environment = Environment.All, serverId?: string) { public static RegisterCommand(name: string, command: Command, environment: Environment = Environment.All, serverId?: string) {

View file

@ -1,5 +1,6 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command"; import { Command } from "../type/command";
import InventoryHelper from "../helpers/InventoryHelper";
export default class Inventory extends Command { export default class Inventory extends Command {
constructor() { constructor() {
@ -11,6 +12,11 @@ export default class Inventory extends Command {
} }
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, 0);
await interaction.reply({
embeds: [ embed.embed ],
components: [ embed.row ],
});
} }
} }

View file

@ -4,6 +4,7 @@ import { CoreClient } from "./client/client";
import About from "./commands/about"; import About from "./commands/about";
import Drop from "./commands/drop"; import Drop from "./commands/drop";
import Gdrivesync from "./commands/gdrivesync"; import Gdrivesync from "./commands/gdrivesync";
import Inventory from "./commands/inventory";
import Resync from "./commands/resync"; import Resync from "./commands/resync";
// Test Command Imports // Test Command Imports
@ -21,6 +22,7 @@ export default class Registry {
CoreClient.RegisterCommand('about', new About()); CoreClient.RegisterCommand('about', new About());
CoreClient.RegisterCommand('drop', new Drop()); CoreClient.RegisterCommand('drop', new Drop());
CoreClient.RegisterCommand('gdrivesync', new Gdrivesync()); CoreClient.RegisterCommand('gdrivesync', new Gdrivesync());
CoreClient.RegisterCommand('inventory', new Inventory());
CoreClient.RegisterCommand('resync', new Resync()); CoreClient.RegisterCommand('resync', new Resync());
// Test Commands // Test Commands