fix(eslint): now is activated and normed using ts comparaison
This commit is contained in:
parent
11befcbad4
commit
561d3e92a6
14 changed files with 122 additions and 145 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,9 @@
|
|||
import { Events, MessageFlags } from "discord.js";
|
||||
import { Events } from "discord.js";
|
||||
import { prisma } from "../../lib/prisma.ts";
|
||||
|
||||
export default {
|
||||
name: Events.GuildCreate,
|
||||
async execute(guild, client) {
|
||||
const botData = await prisma.bot.findUnique({
|
||||
where: {
|
||||
id: 1,
|
||||
},
|
||||
include: {
|
||||
buyers: true,
|
||||
},
|
||||
});
|
||||
async execute(guild) {
|
||||
await prisma.guild.upsert({
|
||||
where: {
|
||||
id: guild.id,
|
||||
|
|
@ -23,8 +15,7 @@ export default {
|
|||
});
|
||||
|
||||
const members = await guild.members.fetch();
|
||||
let i = 0;
|
||||
for (const [memberId, member] of members) {
|
||||
for (const [memberId] of members) {
|
||||
await prisma.user.upsert({
|
||||
where: {
|
||||
id: memberId,
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ export default {
|
|||
once: true,
|
||||
async execute(client) {
|
||||
try {
|
||||
let botData: Bot;
|
||||
botData = await prisma.bot.findUnique({
|
||||
const botData: Bot = await prisma.bot.findUnique({
|
||||
where: {
|
||||
id: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import path from "node:path";
|
|||
import "dotenv/config";
|
||||
import { Client, Collection, GatewayIntentBits } from "discord.js";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { deployCommands } from "./internal/deploy-commands.ts";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ client.commands = new Collection();
|
|||
const commandFolderPath = path.join(__dirname, "commands");
|
||||
const commandFolders = fs.readdirSync(commandFolderPath);
|
||||
|
||||
console.log(`\n🔍 | Commands search:`);
|
||||
console.log("\n🔍 | Commands search:");
|
||||
for (const folder of commandFolders) {
|
||||
const commandsPath = path.join(commandFolderPath, folder);
|
||||
const commandFiles = fs
|
||||
|
|
@ -48,7 +47,7 @@ console.log("\n\n");
|
|||
const eventFolderPath = path.join(__dirname, "events");
|
||||
const eventFolders = fs.readdirSync(eventFolderPath);
|
||||
|
||||
console.log(`\n🔍 | Events search:`);
|
||||
console.log("\n🔍 | Events search:");
|
||||
for (const folder of eventFolders) {
|
||||
const eventsPath = path.join(eventFolderPath, folder);
|
||||
const eventFiles = fs
|
||||
|
|
@ -97,7 +96,7 @@ client.once("ready", async () => {
|
|||
|
||||
const members = await guild.members.fetch();
|
||||
|
||||
for (const [memberId, member] of members) {
|
||||
for (const [memberId] of members) {
|
||||
await prisma.user.upsert({
|
||||
where: {
|
||||
id: memberId,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
import { REST, Routes } from "discord.js";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import {
|
||||
Client,
|
||||
Collection,
|
||||
Events,
|
||||
GatewayIntentBits,
|
||||
MessageFlags,
|
||||
} from "discord.js";
|
||||
import { Client, Collection, GatewayIntentBits } from "discord.js";
|
||||
import "dotenv/config";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
|
@ -35,7 +28,7 @@ for (const folder of commandFolders) {
|
|||
commands.push(command.data.toJSON());
|
||||
} else {
|
||||
console.log(
|
||||
`⚠️ | A Command is missing a required "data" or "execute" property.`,
|
||||
'⚠️ | A Command is missing a required "data" or "execute" property.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue