init base

This commit is contained in:
Tutur33
2024-02-13 23:28:33 +01:00
parent 3e79697d37
commit ab1520b104
6 changed files with 98 additions and 77 deletions
+8 -11
View File
@@ -1,14 +1,11 @@
const { Events, InteractionType } = require("discord.js")
const { Events, InteractionType } = require("discord.js");
module.exports = {
name :Events.InteractionCreate,
async run(client, interaction) {
if(interaction.type === InteractionType.ApplicationCommand) {
const command = client.commands.get(interaction.commandName);
await command.execute(interaction, client);
};
name: Events.InteractionCreate,
async run(client, interaction) {
if (interaction.type === InteractionType.ApplicationCommand) {
const command = client.commands.get(interaction.commandName);
await command.execute(interaction, client);
}
};
},
};
+26 -11
View File
@@ -1,15 +1,30 @@
const { Events, ActivityType } = require("discord.js")
const { Events, ActivityType } = require("discord.js");
module.exports = {
name: Events.ClientReady,
async run(client) {
if (client.commands && Array.isArray(client.commands)) {
client.application.commands.set(
client.commands.map((command) => command.data)
);
} else {
console.error("Les commandes du client sont manquantes ou mal formatées\n");
}
console.log(`
[${new Date().toLocaleString()}] Logged in as ${client.user.tag} with:
- ${client.guilds.cache.size} guilds
- ${client.channels.cache.size} channels
- ${client.users.cache.size} users
`);
name : Events.ClientReady,
async run(client) {
client.user.setActivity({
name: "&help",
type: ActivityType.Streaming, //Playing, Streaming, Listening, Watching, Custom, Competing
url: "https://www.twitch.tv/tuturp33"
});
const activityTypes = ['Playing', 'Streaming', 'Listening', 'Watching', 'Custom', 'Competing'];
let activityType = activityTypes[client.user.presence.activities[0].type] || 'Unknown';
console.log(`[${new Date().toLocaleString()}] Bot activity set to ${activityType}: ${client.user.presence.activities[0].name}\n`);
if (client.commands && Array.isArray(client.commands)) {
client.application.commands.set(client.commands.map(command => command.data));
} else {
console.error('Les commandes du client sont manquantes ou mal formatées');
}
console.log(`${client.user.username} est en ligne`);
},
},
};