fix(eslint): now is activated and normed using ts comparaison

This commit is contained in:
Raphael 2025-08-18 14:45:46 +02:00
parent 11befcbad4
commit 561d3e92a6
14 changed files with 122 additions and 145 deletions

View file

@ -8,10 +8,6 @@ import {
StringSelectMenuInteraction,
StringSelectMenuOptionBuilder,
SlashCommandBuilder,
ChatInputCommandInteractionActivityType,
channelMention,
roleMention,
PresenceUpdateStatus,
MessageFlags,
SlashCommandBuilder,
EmbedBuilder,
@ -77,7 +73,14 @@ export default {
}
const choice: string = interaction.options.getString("action");
switch (choice) {
case "logs_show":
case "logs_show": {
if (!userData.isOwner) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for owner`,
flags: MessageFlags.Ephemeral,
});
return;
}
if (guildData.logEnable) {
const logsData: EmbedBuilder = new EmbedBuilder()
.setTitle(`Logs for ${interaction.guild.name}`)
@ -104,7 +107,15 @@ export default {
});
}
return;
case "logs_auto":
}
case "logs_auto": {
if (!userData.isOwner) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for owner`,
flags: MessageFlags.Ephemeral,
});
return;
}
if (guildData.logEnable) {
await interaction.reply({
content: `${emoji.answer.error} | The log is already setup on this server`,
@ -133,8 +144,8 @@ export default {
const roleSelection =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(menu);
let permSelector: EmbedBuilder = new EmbedBuilder()
.setTitle(`Which role will have access`)
const permSelector: EmbedBuilder = new EmbedBuilder()
.setTitle("Which role will have access")
.setColor(`${guildData.color}`)
.setFooter({
text: guildData.footer,
@ -242,7 +253,7 @@ export default {
.map((id) => `- <@&${id}>`)
.join("\n");
const autoConfig = new EmbedBuilder()
.setTitle(`The logs category is created`)
.setTitle("The logs category is created")
.setDescription(
`
This following roles will have access to the logs.
@ -260,6 +271,8 @@ export default {
return;
},
);
break;
}
default:
console.error(`no choice on logs command ${choice}`);
return;

View file

@ -1,12 +1,9 @@
import { prisma } from "../../lib/prisma.ts";
import {
ActivityType,
userMention,
roleMention,
PresenceUpdateStatus,
MessageFlags,
SlashCommandBuilder,
EmbedBuilder,
} from "discord.js";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
@ -111,23 +108,6 @@ export default {
),
),
async execute(interaction: CommandInteraction) {
let guildData: Guild;
try {
guildData = await prisma.guild.findUnique({
where: {
id: interaction.guild.id,
},
});
} catch (err) {
console.error(
`\t⚠ | Cannot get the database connection!\n\t\t(${err}).`,
);
await interaction.reply({
content: `${emoji.answer.error} | Cannot connect to the database`,
flags: MessageFlags.Ephemeral,
});
return;
}
let userData: User;
try {
userData = await prisma.user.findUnique({
@ -147,7 +127,7 @@ export default {
}
const subcommand: string = interaction.options.getSubcommand();
switch (subcommand) {
case "color":
case "color": {
if (!userData.isOwner) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for owner`,
@ -180,7 +160,8 @@ export default {
flags: MessageFlags.Ephemeral,
});
return;
case "footer":
}
case "footer": {
if (!userData.isOwner) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for owner`,
@ -213,7 +194,8 @@ export default {
flags: MessageFlags.Ephemeral,
});
return;
case "pp":
}
case "pp": {
if (!userData.isBuyer) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for buyer`,
@ -229,13 +211,17 @@ export default {
content: `${emoji.answer.no} | Error during changing the bot profile picture`,
flags: MessageFlags.Ephemeral,
});
console.error(
`\t⚠ | Cannot change the bot profile picture!\n\t\t(${err}).`,
);
}
await interaction.reply({
content: `${emoji.answer.yes} | The picture profile of the bot is now updated.`,
flags: MessageFlags.Ephemeral,
});
return;
case "status":
}
case "status": {
if (!userData.isBuyer) {
await interaction.reply({
content: `${emoji.answer.no} | This command is only for buyer`,
@ -330,6 +316,7 @@ export default {
flags: MessageFlags.Ephemeral,
});
return;
}
}
},
};

View file

@ -1,9 +1,4 @@
import {
EmbedBuilder,
userMention,
MessageFlags,
SlashCommandBuilder,
} from "discord.js";
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
import { prisma } from "../../lib/prisma.ts";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
@ -116,7 +111,7 @@ export default {
});
} catch (err) {
console.error(
`⚠️ | Error when adding ${target.username} to the buyer list`,
`⚠️ | Error when adding ${target.username} to the buyer list\n\t${err}`,
);
await interaction.reply({
content: `${emoji.answer.error} | Error when adding ${target.username} to the owner list`,
@ -177,7 +172,7 @@ export default {
});
} catch (err) {
console.error(
`⚠️ | Error when removing ${target.username} to the username`,
`⚠️ | Error when removing ${target.username} to the buyer list\n\t${err}`,
);
return;
}

View file

@ -1,9 +1,4 @@
import {
EmbedBuilder,
userMention,
MessageFlags,
SlashCommandBuilder,
} from "discord.js";
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
import { prisma } from "../../lib/prisma.ts";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
@ -109,7 +104,7 @@ export default {
});
} catch (err) {
console.error(
`⚠️ | Error when adding ${target.username} to the username`,
`⚠️ | Error when adding ${target.username} to the owner list\n\t${err}`,
);
await interaction.reply({
content: `${emoji.answer.error} | Error when adding ${target.username} to the owner list`,
@ -163,7 +158,7 @@ export default {
});
} catch (err) {
console.error(
`⚠️ | Error when removing ${target.username} to the username`,
`⚠️ | Error when removing ${target.username} to the owner list\n\t${err}`,
);
await interaction.reply({
content: `${emoji.answer.error} | Cannot removing the user from the owner list`,

View file

@ -1,9 +1,4 @@
import {
EmbedBuilder,
userMention,
MessageFlags,
SlashCommandBuilder,
} from "discord.js";
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
import { prisma } from "../../lib/prisma.ts";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
@ -223,7 +218,7 @@ export default {
);
const toSend: EmbedBuilder = new EmbedBuilder()
.setTitle(`🗞️ | Whitelist`)
.setTitle("🗞️ | Whitelist")
.setColor(guildData.color)
.setFooter({
text: guildData.footer,

View file

@ -1,11 +1,4 @@
import {
MessageFlags,
ChatInputCommandInteraction,
CategoryChannel,
ChannelType,
PermissionsBitField,
SlashCommandBuilder,
} from "discord.js";
import { MessageFlags, ChannelType, SlashCommandBuilder } from "discord.js";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
import { prisma } from "../../lib/prisma.ts";

View file

@ -84,7 +84,7 @@ export default {
}
const subcommand: string = interaction.options.getSubcommand();
switch (subcommand) {
case "user":
case "user": {
const targetGlobal: GuildMember =
interaction.options.getUser("target") || interaction.user;
await targetGlobal.fetch();
@ -151,7 +151,8 @@ export default {
flags: MessageFlags.Ephemeral,
});
return;
case "server":
}
case "server": {
const guild: Guild = interaction.guild;
const serverResult: EmbedBuilder = new EmbedBuilder()
.setTitle(`${guild.name} Informations`)
@ -190,6 +191,7 @@ export default {
embeds: [serverResult],
flags: MessageFlags.Ephemeral,
});
}
}
},
};