style(norme/eslint): now edited the husky rules before commiting

This commit is contained in:
Raphael 2025-08-18 14:57:23 +02:00
parent 439ddab587
commit 1c4c0f5872
16 changed files with 1883 additions and 1845 deletions

View file

@ -1,48 +1,48 @@
import { Events } from "discord.js";
import { prisma } from "../../lib/prisma.ts";
import { Events } from 'discord.js';
import { prisma } from '../../lib/prisma.ts';
export default {
name: Events.GuildCreate,
async execute(guild) {
await prisma.guild.upsert({
where: {
id: guild.id,
},
update: {},
create: {
id: guild.id,
},
});
name: Events.GuildCreate,
async execute(guild) {
await prisma.guild.upsert({
where: {
id: guild.id,
},
update: {},
create: {
id: guild.id,
},
});
const members = await guild.members.fetch();
for (const [memberId] of members) {
await prisma.user.upsert({
where: {
id: memberId,
},
update: {},
create: {
id: memberId,
},
});
const members = await guild.members.fetch();
for (const [memberId] of members) {
await prisma.user.upsert({
where: {
id: memberId,
},
update: {},
create: {
id: memberId,
},
});
await prisma.guildUser.upsert({
where: {
userId_guildId: {
userId: memberId,
guildId: guild.id,
},
},
update: {},
create: {
userId: memberId,
guildId: guild.id,
},
});
i++;
}
console.log(
`✅ | Guild ${guild.name} synchronisée avec ${members.size} membres.`,
);
},
await prisma.guildUser.upsert({
where: {
userId_guildId: {
userId: memberId,
guildId: guild.id,
},
},
update: {},
create: {
userId: memberId,
guildId: guild.id,
},
});
i++;
}
console.log(
`✅ | Guild ${guild.name} synchronisée avec ${members.size} membres.`,
);
},
};

View file

@ -1,80 +1,82 @@
import { ActivityType, PresenceUpdateStatus, Events } from "discord.js";
import { prisma } from "../../lib/prisma.ts";
import { ActivityType, PresenceUpdateStatus, Events } from 'discord.js';
import { prisma } from '../../lib/prisma.ts';
export default {
name: Events.ClientReady,
once: true,
async execute(client) {
try {
const botData: Bot = await prisma.bot.findUnique({
where: {
id: 1,
},
});
const newStatus: string = botData.status;
const tmpType: string = botData.type;
let newType: ActivityType;
switch (tmpType) {
case "play":
newType = ActivityType.Playing;
break;
case "listen":
newType = ActivityType.Listening;
break;
case "watch":
newType = ActivityType.Watching;
break;
case "stream":
newType = ActivityType.Streaming;
break;
case "comptet":
newType = ActivityType.Competing;
break;
}
const tmpPresence: string = botData.presence;
let newPresence: PresenceUpdateStatus;
switch (tmpPresence) {
case "online":
newPresence = PresenceUpdateStatus.Online;
break;
case "idle":
newPresence = PresenceUpdateStatus.Idle;
break;
case "dnd":
newPresence = PresenceUpdateStatus.DoNotDisturb;
break;
case "invisible":
newPresence = PresenceUpdateStatus.Invisible;
break;
}
if (botData.type === "steam") {
client.user.setPresence({
status: newPresence,
activities: [
{
name: newStatus,
type: newType,
url: "https://twich.tv/EniumRaphael",
},
],
});
} else {
client.user.setPresence({
status: newPresence,
activities: [
{
name: newStatus,
type: newType,
},
],
});
}
} catch (err) {
console.error(
`\t⚠ | Cannot get the database connection!\n\t\t(${err}).`,
);
return;
}
console.log(`✅ | ${client.user.username} is now running under TTS bot`);
},
name: Events.ClientReady,
once: true,
async execute(client) {
try {
const botData: Bot = await prisma.bot.findUnique({
where: {
id: 1,
},
});
const newStatus: string = botData.status;
const tmpType: string = botData.type;
let newType: ActivityType;
switch (tmpType) {
case 'play':
newType = ActivityType.Playing;
break;
case 'listen':
newType = ActivityType.Listening;
break;
case 'watch':
newType = ActivityType.Watching;
break;
case 'stream':
newType = ActivityType.Streaming;
break;
case 'comptet':
newType = ActivityType.Competing;
break;
}
const tmpPresence: string = botData.presence;
let newPresence: PresenceUpdateStatus;
switch (tmpPresence) {
case 'online':
newPresence = PresenceUpdateStatus.Online;
break;
case 'idle':
newPresence = PresenceUpdateStatus.Idle;
break;
case 'dnd':
newPresence = PresenceUpdateStatus.DoNotDisturb;
break;
case 'invisible':
newPresence = PresenceUpdateStatus.Invisible;
break;
}
if (botData.type === 'steam') {
client.user.setPresence({
status: newPresence,
activities: [
{
name: newStatus,
type: newType,
url: 'https://twich.tv/EniumRaphael',
},
],
});
}
else {
client.user.setPresence({
status: newPresence,
activities: [
{
name: newStatus,
type: newType,
},
],
});
}
}
catch (err) {
console.error(
`\t⚠ | Cannot get the database connection!\n\t\t(${err}).`,
);
return;
}
console.log(`✅ | ${client.user.username} is now running under TTS bot`);
},
};

View file

@ -1,36 +1,38 @@
import { Events, MessageFlags } from "discord.js";
import emoji from "../../../assets/emoji.json" assert { type: "json" };
import { Events, MessageFlags } from 'discord.js';
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
export default {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`⚠️ | Can't execute ${interaction.commandName}`);
await interaction.reply({
content: `${emoji.answer.error} | Cannot execute the command ${interaction.commandName}`,
flags: MessageFlags.Ephemeral,
});
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(
`⚠️ | Error when occured this command ${interaction.commandName}\n\t${error}`,
);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (After Print)`,
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (Before Print)`,
flags: MessageFlags.Ephemeral,
});
}
}
},
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`⚠️ | Can't execute ${interaction.commandName}`);
await interaction.reply({
content: `${emoji.answer.error} | Cannot execute the command ${interaction.commandName}`,
flags: MessageFlags.Ephemeral,
});
return;
}
try {
await command.execute(interaction);
}
catch (error) {
console.error(
`⚠️ | Error when occured this command ${interaction.commandName}\n\t${error}`,
);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (After Print)`,
flags: MessageFlags.Ephemeral,
});
}
else {
await interaction.reply({
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (Before Print)`,
flags: MessageFlags.Ephemeral,
});
}
}
},
};