Maj pkgs + fix dep des buttons / commands + Ajout fichiers utils
This commit is contained in:
17
app.js
17
app.js
@@ -12,14 +12,8 @@ const client = new Client({ intents })
|
||||
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'))
|
||||
for (const file of eventFiles) {
|
||||
let event = require(`./events/${file}`)
|
||||
if (event.once) client.once(event.name, (...args) => {
|
||||
//console.log(`\u001b[1;35m Event '${event.name}' executed.`)
|
||||
event.execute(...args)
|
||||
})
|
||||
else client.on(event.name, (...args) => {
|
||||
//console.log(`\u001b[1;35m Event '${event.name}' executed.`)
|
||||
event.execute(...args)
|
||||
})
|
||||
if (event.once) client.once(event.name, (...args) => { event.execute(...args) })
|
||||
else client.on(event.name, (...args) => { event.execute(...args) })
|
||||
}
|
||||
|
||||
// COMMANDS HANDLING
|
||||
@@ -39,11 +33,7 @@ for (folder of commandFolders) {
|
||||
// COMMANDS REGISTERING
|
||||
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
|
||||
(async () => {
|
||||
//console.log(`\u001b[1;35m Started refreshing ${commands.length} application (/) commands.`)
|
||||
try {
|
||||
let data = await rest.put(Routes.applicationCommands('1065047326860783636'), { body: commands })
|
||||
//console.log(`\u001b[1;35m Successfully reloaded ${data.length} application (/) commands.`)
|
||||
}
|
||||
try { await rest.put(Routes.applicationCommands(process.env.DISCORD_APP_ID), { body: commands }) }
|
||||
catch (error) { console.error(error) }
|
||||
})()
|
||||
|
||||
@@ -68,7 +58,6 @@ for (const file of eventPlayerFiles) {
|
||||
if (['debug'].includes(event.name)) continue
|
||||
player.events.on(event.name, (...args) => event.execute(...args))
|
||||
}
|
||||
//player.on('debug', async (message) => { console.log(`General player debug event: ${message}`) })
|
||||
|
||||
// LAUNCH
|
||||
client.login()
|
||||
Reference in New Issue
Block a user