Upgrade discord.js
All checks were successful
Test / build (push) Successful in 53s

This commit is contained in:
Ethan Lane 2025-06-19 19:14:40 +01:00
parent 983195c477
commit 2bf961d1e5
32 changed files with 88 additions and 106 deletions

View file

@ -1,4 +1,4 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours";
import { Command } from "../type/command";
@ -11,7 +11,7 @@ export default class About extends Command {
.setDescription("About Bot");
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const fundingLink = process.env.ABOUT_FUNDING;
const repoLink = process.env.ABOUT_REPO;

View file

@ -1,4 +1,4 @@
import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours";
import { Command } from "../type/command";
import User from "../database/entities/app/User";
@ -13,7 +13,7 @@ export default class AllBalance extends Command {
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const users = await User.FetchAll(User);
const filteredUsers = users.filter(x => x.Currency > 0)

View file

@ -1,4 +1,4 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import User from "../database/entities/app/User";
import EmbedColours from "../constants/EmbedColours";
@ -12,7 +12,7 @@ export default class Balance extends Command {
.setDescription("Get your currency balance");
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const user = await User.FetchOneById(User, interaction.user.id);
const userBalance = user != null ? user.Currency : 0;

View file

@ -1,4 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import User from "../database/entities/app/User";
import CardConstants from "../constants/CardConstants";
@ -13,7 +13,7 @@ export default class Daily extends Command {
.setDescription("Gain bonus currency, once a day");
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const user = await User.FetchOneById(User, interaction.user.id) ?? new User(interaction.user.id, CardConstants.StartingCurrency);
const dayAgo = new Date(Date.now() - (1000 * 60 * 60 * 24));

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CommandInteraction, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { readFileSync } from "fs";
import { CoreClient } from "../client/client";
@ -23,7 +23,7 @@ export default class Drop extends Command {
.setDescription("Summon a new card drop");
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
if (!CoreClient.AllowDrops) {
await interaction.reply(ErrorMessages.BotSyncing);
return;

View file

@ -1,4 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { EffectChoices } from "../constants/EffectDetails";
import AppLogger from "../client/appLogger";
@ -42,9 +42,7 @@ export default class Effects extends Command {
.setMinValue(1)));
}
public override async execute(interaction: CommandInteraction) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
const subcommand = interaction.options.getSubcommand();
switch (subcommand) {

View file

@ -1,7 +1,7 @@
import { CommandInteraction } from "discord.js";
import { ChatInputCommandInteraction } from "discord.js";
import EffectHelper from "../../helpers/EffectHelper";
export default async function Buy(interaction: CommandInteraction) {
export default async function Buy(interaction: ChatInputCommandInteraction) {
const id = interaction.options.get("id", true).value!;
const quantity = interaction.options.get("quantity")?.value ?? 1;

View file

@ -1,7 +1,7 @@
import { CommandInteraction } from "discord.js";
import { ChatInputCommandInteraction } from "discord.js";
import EffectHelper from "../../helpers/EffectHelper";
export default async function List(interaction: CommandInteraction) {
export default async function List(interaction: ChatInputCommandInteraction) {
const pageOption = interaction.options.get("page");
const page = !isNaN(Number(pageOption?.value)) ? Number(pageOption?.value) : 1;

View file

@ -1,11 +1,11 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
import { EffectDetails } from "../../constants/EffectDetails";
import AppLogger from "../../client/appLogger";
import EffectHelper from "../../helpers/EffectHelper";
import TimeLengthInput from "../../helpers/TimeLengthInput";
import EmbedColours from "../../constants/EmbedColours";
export default async function Use(interaction: CommandInteraction) {
export default async function Use(interaction: ChatInputCommandInteraction) {
const id = interaction.options.get("id", true).value!.toString();
const effectDetail = EffectDetails.get(id);

View file

@ -1,4 +1,4 @@
import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { ExecException, exec } from "child_process";
import { CoreClient } from "../client/client";
@ -16,9 +16,7 @@ export default class Gdrivesync extends Command {
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");
if (!whitelistedUsers.find(x => x == interaction.user.id)) {

View file

@ -1,4 +1,4 @@
import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import Config from "../database/entities/app/Config";
@ -45,9 +45,7 @@ export default class Give extends Command {
.setRequired(true)));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");
if (!whitelistedUsers.find(x => x == interaction.user.id)) {
@ -65,7 +63,7 @@ export default class Give extends Command {
}
}
private async GiveCard(interaction: CommandInteraction) {
private async GiveCard(interaction: ChatInputCommandInteraction) {
if (!CoreClient.AllowDrops) {
await interaction.reply("Bot is currently syncing, please wait until its done.");
return;
@ -101,7 +99,7 @@ export default class Give extends Command {
await interaction.reply(`Card ${card.card.name} given to ${user.username}, they now have ${inventory.Quantity}`);
}
private async GiveCurrency(interaction: CommandInteraction) {
private async GiveCurrency(interaction: ChatInputCommandInteraction) {
const amount = interaction.options.get("amount", true);
const user = interaction.options.get("user", true).user!;

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CommandInteraction, DiscordAPIError, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, ChatInputCommandInteraction, DiscordAPIError, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import { readFileSync } from "fs";
@ -21,7 +21,7 @@ export default class Id extends Command {
.setRequired(true));
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const cardNumber = interaction.options.get("cardnumber");
AppLogger.LogSilly("Commands/View", `Parameters: cardNumber=${cardNumber?.value}`);

View file

@ -1,4 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import InventoryHelper from "../helpers/InventoryHelper";
import AppLogger from "../client/appLogger";
@ -20,7 +20,7 @@ export default class Inventory extends Command {
.setDescription("The user to view (Defaults to yourself)"));
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const page = interaction.options.get("page");
const userOption = interaction.options.get("user");

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CommandInteraction, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import ErrorMessages from "../constants/ErrorMessages";
@ -21,7 +21,7 @@ export default class Multidrop extends Command {
.setDescription("Drop 11 cards for the price of 10!");
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
if (!CoreClient.AllowDrops) {
await interaction.reply(ErrorMessages.BotSyncing);
return;

View file

@ -1,4 +1,4 @@
import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import Config from "../database/entities/app/Config";
import CardMetadataFunction from "../Functions/CardMetadataFunction";
@ -14,7 +14,7 @@ export default class Resync extends Command {
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction<CacheType>) {
public override async execute(interaction: ChatInputCommandInteraction) {
if (!interaction.isChatInputCommand()) return;
const whitelistedUsers = process.env.BOT_ADMINS!.split(",");

View file

@ -1,4 +1,4 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CacheType, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import Inventory from "../database/entities/app/Inventory";
import { CardRarityToString, GetSacrificeAmount } from "../constants/CardRarity";
@ -23,7 +23,7 @@ export default class Sacrifice extends Command {
.setDescription("The amount to sacrifice (default 1)"));
}
public override async execute(interaction: CommandInteraction<CacheType>): Promise<void> {
public override async execute(interaction: ChatInputCommandInteraction): Promise<void> {
const cardnumber = interaction.options.get("cardnumber", true);
const quantityInput = interaction.options.get("quantity")?.value ?? 1;

View file

@ -1,4 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import AppLogger from "../client/appLogger";
@ -26,9 +26,7 @@ export default class Series extends Command {
.setDescription("List all series")) as SlashCommandBuilder;
}
public override async execute(interaction: CommandInteraction) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
switch (interaction.options.getSubcommand()) {
case "view":
await this.ViewSeries(interaction);
@ -42,7 +40,7 @@ export default class Series extends Command {
}
}
private async ViewSeries(interaction: CommandInteraction) {
private async ViewSeries(interaction: ChatInputCommandInteraction) {
const id = interaction.options.get("id");
AppLogger.LogSilly("Commands/Series/View", `Parameters: id=${id?.value}`);
@ -74,7 +72,7 @@ export default class Series extends Command {
}
}
private async ListSeries(interaction: CommandInteraction) {
private async ListSeries(interaction: ChatInputCommandInteraction) {
const embed = SeriesHelper.GenerateSeriesListPage(0);
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]});

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CacheType, CommandInteraction, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../../type/command";
import { readFileSync } from "fs";
import Inventory from "../../database/entities/app/Inventory";
@ -22,9 +22,7 @@ export default class Dropnumber extends Command {
.setRequired(true));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
const cardNumber = interaction.options.get("cardnumber");
if (!cardNumber || !cardNumber.value) {

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, CacheType, CommandInteraction, SlashCommandBuilder } from "discord.js";
import { AttachmentBuilder, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../../type/command";
import { CardRarity, CardRarityChoices, CardRarityParse } from "../../constants/CardRarity";
import { readFileSync } from "fs";
@ -24,9 +24,7 @@ export default class Droprarity extends Command {
.setChoices(CardRarityChoices));
}
public override async execute(interaction: CommandInteraction<CacheType>) {
if (!interaction.isChatInputCommand()) return;
public override async execute(interaction: ChatInputCommandInteraction) {
const rarity = interaction.options.get("rarity");
if (!rarity || !rarity.value) {

View file

@ -1,4 +1,4 @@
import {CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder} from "discord.js";
import {ChatInputCommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder} from "discord.js";
import {Command} from "../type/command";
import {CoreClient} from "../client/client";
import {CardRarity} from "../constants/CardRarity";
@ -14,7 +14,7 @@ export default class Stats extends Command {
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const allCards = CoreClient.Cards.flatMap(x => x.cards);
const totalCards = allCards.length;

View file

@ -1,4 +1,4 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import Inventory from "../database/entities/app/Inventory";
import { CoreClient } from "../client/client";
@ -37,7 +37,7 @@ export default class Trade extends Command {
.setDescription("Amount to receive"));
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const user = interaction.options.get("user", true).user!;
const give = interaction.options.get("give", true);
const receive = interaction.options.get("receive", true);
@ -122,7 +122,7 @@ export default class Trade extends Command {
await interaction.reply({ content: `${user}`, embeds: [ tradeEmbed ], components: [ row ] });
}
private async autoDecline(interaction: CommandInteraction, user1Username: string, user2Username: string, user1CardNumber: string, user2CardNumber: string, user1CardName: string, user2CardName: string, user1Quantity: number, user2Quantity: number) {
private async autoDecline(interaction: ChatInputCommandInteraction, user1Username: string, user2Username: string, user1CardNumber: string, user2CardNumber: string, user1CardName: string, user2CardName: string, user1Quantity: number, user2Quantity: number) {
AppLogger.LogSilly("Commands/Trade/AutoDecline", `Auto declining trade between ${user1Username} and ${user2Username}`);
const tradeEmbed = new EmbedBuilder()

View file

@ -1,4 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command";
import AppLogger from "../client/appLogger";
import CardSearchHelper from "../helpers/CardSearchHelper";
@ -17,7 +17,7 @@ export default class View extends Command {
.setRequired(true));
}
public override async execute(interaction: CommandInteraction) {
public override async execute(interaction: ChatInputCommandInteraction) {
const name = interaction.options.get("name", true);
AppLogger.LogSilly("Commands/View", `Parameters: name=${name.value}`);