style(emoji/json): update the emoji to be on a json file

This commit is contained in:
Raphael 2025-07-31 23:14:03 +02:00
parent de2380e82e
commit f1398c7d48
6 changed files with 236 additions and 49 deletions

View file

@ -1,9 +1,79 @@
import { Events } from 'discord.js'
import { ActivityType, PresenceUpdateStatus, Events } from 'discord.js'
import { prisma } from '../../lib/prisma.ts';
export default {
name: Events.ClientReady,
once: true,
execute(client) {
async execute(client) {
try {
let botData: Bot;
botData = 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⚠ | INFO => 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;
}
console.log(`✅ | ${client.user.username} is now running under TTS bot`);
},
};