Fix eslint issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ethan Lane 2024-01-03 18:29:34 +00:00
parent 1e16644732
commit 808314701e
7 changed files with 23 additions and 19 deletions

View file

@ -32,5 +32,14 @@
"error", "error",
"always" "always"
] ]
} },
"globals": {
"jest": true,
"require": true,
"exports": true,
"process": true
},
"ignorePatterns": [
"dist/**/*"
]
} }

View file

@ -1,4 +1,4 @@
import { AttachmentBuilder, ButtonInteraction, DiscordAPIError } from "discord.js"; import { AttachmentBuilder, ButtonInteraction } from "discord.js";
import { ButtonEvent } from "../type/buttonEvent"; import { ButtonEvent } from "../type/buttonEvent";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { v4 } from "uuid"; import { v4 } from "uuid";
@ -28,11 +28,9 @@ export default class Reroll extends ButtonEvent {
} }
try { try {
let image: Buffer; const image = readFileSync(path.join(process.cwd(), "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), "cards", randomCard.card.path));
await interaction.deferReply(); await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName }); const attachment = new AttachmentBuilder(image, { name: imageFileName });

View file

@ -1,20 +1,18 @@
import { Client, DMChannel, Guild, GuildBan, GuildMember, Message, NonThreadGuildBasedChannel, PartialGuildMember, PartialMessage } from "discord.js"; import { Client, DMChannel, Guild, GuildBan, GuildMember, Message, NonThreadGuildBasedChannel, PartialGuildMember, PartialMessage } from "discord.js";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import { EventType } from "../constants/EventType";
import ICommandItem from "../contracts/ICommandItem"; import ICommandItem from "../contracts/ICommandItem";
import EventExecutors from "../contracts/EventExecutors"; import EventExecutors from "../contracts/EventExecutors";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { Events } from "./events"; import { Events } from "./events";
import { Util } from "./util"; import { Util } from "./util";
import IButtonEventItem from "../contracts/IButtonEventItem"; import IButtonEventItem from "../contracts/ButtonEventItem";
import { ButtonEvent } from "../type/buttonEvent"; import { ButtonEvent } from "../type/buttonEvent";
import AppDataSource from "../database/dataSources/appDataSource"; import AppDataSource from "../database/dataSources/appDataSource";
import { Environment } from "../constants/Environment"; import { Environment } from "../constants/Environment";
import Webhooks from "../webhooks"; import Webhooks from "../webhooks";
import CardMetadataFunction from "../Functions/CardMetadataFunction"; import CardMetadataFunction from "../Functions/CardMetadataFunction";
import { SeriesMetadata } from "../contracts/SeriesMetadata"; import { SeriesMetadata } from "../contracts/SeriesMetadata";
import InventoryHelper from "../helpers/InventoryHelper";
export class CoreClient extends Client { export class CoreClient extends Client {
private static _commandItems: ICommandItem[]; private static _commandItems: ICommandItem[];
@ -90,7 +88,7 @@ export class CoreClient extends Client {
ServerId: serverId, ServerId: serverId,
}; };
if (environment &= CoreClient.Environment) { if ((environment & CoreClient.Environment) == CoreClient.Environment) {
CoreClient._commandItems.push(item); CoreClient._commandItems.push(item);
} }
} }
@ -354,7 +352,7 @@ export class CoreClient extends Client {
Environment: environment, Environment: environment,
}; };
if (environment &= CoreClient.Environment) { if ((environment & CoreClient.Environment) == CoreClient.Environment) {
CoreClient._buttonEvents.push(item); CoreClient._buttonEvents.push(item);
} }
} }

View file

@ -1,4 +1,4 @@
import { ButtonInteraction, Interaction } from "discord.js"; import { ButtonInteraction } from "discord.js";
import { CoreClient } from "../client"; import { CoreClient } from "../client";
export default class Button { export default class Button {

View file

@ -1,5 +1,4 @@
import { Client, REST, Routes, SlashCommandBuilder } from "discord.js"; import { Client, REST, Routes, SlashCommandBuilder } from "discord.js";
import { EventType } from "../constants/EventType";
import EventExecutors from "../contracts/EventExecutors"; import EventExecutors from "../contracts/EventExecutors";
import { CoreClient } from "./client"; import { CoreClient } from "./client";
@ -15,7 +14,7 @@ export class Util {
for (const command of globalCommands) { for (const command of globalCommands) {
if (!command.Command.CommandBuilder) continue; if (!command.Command.CommandBuilder) continue;
if (command.Environment &= CoreClient.Environment) { if ((command.Environment & CoreClient.Environment) == CoreClient.Environment) {
globalCommandData.push(command.Command.CommandBuilder); globalCommandData.push(command.Command.CommandBuilder);
} }
} }
@ -43,7 +42,7 @@ export class Util {
for (const command of guildCommands.filter(x => x.ServerId == guild)) { for (const command of guildCommands.filter(x => x.ServerId == guild)) {
if (!command.Command.CommandBuilder) continue; if (!command.Command.CommandBuilder) continue;
if (command.Environment &= CoreClient.Environment) { if ((command.Environment & CoreClient.Environment) == CoreClient.Environment) {
guildCommandData.push(command.Command.CommandBuilder); guildCommandData.push(command.Command.CommandBuilder);
} }
} }

View file

@ -36,11 +36,9 @@ export default class Drop extends Command {
} }
try { try {
let image: Buffer; const image = readFileSync(path.join(process.cwd(), "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), "cards", randomCard.card.path));
await interaction.deferReply(); await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName }); const attachment = new AttachmentBuilder(image, { name: imageFileName });

View file

@ -1,8 +1,10 @@
import { Environment } from "../constants/Environment"; import { Environment } from "../constants/Environment";
import { ButtonEvent } from "../type/buttonEvent"; import { ButtonEvent } from "../type/buttonEvent";
export default interface IButtonEventItem { interface ButtonEventItem {
ButtonId: string, ButtonId: string,
Event: ButtonEvent, Event: ButtonEvent,
Environment: Environment, Environment: Environment,
} }
export default ButtonEventItem;