Formatting

This commit is contained in:
Marius Begby committed 2023-07-17 12:43:33 +02:00
1 parent 1d520e95bd
commit bea3894c03
1 file changed
+10 -28
+10 -28
View File
@@ -14,18 +14,14 @@ for (const folder of commandFolders) {
.filter((file) => file.endsWith('.js')); .filter((file) => file.endsWith('.js'));
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(path.resolve( const command = require(path.resolve(`./src/commands/${folder}/${file}`));
`./src/commands/${folder}/${file}`
));
command.isSystemCommand command.isSystemCommand
? systemCommands.push(command.data.toJSON()) ? systemCommands.push(command.data.toJSON())
: slashCommands.push(command.data.toJSON()); : slashCommands.push(command.data.toJSON());
} }
} }
const rest = new REST({ version: '10' }).setToken( const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_TOKEN);
process.env.DISCORD_BOT_TOKEN
);
(async () => { (async () => {
try { try {
@@ -38,12 +34,9 @@ const rest = new REST({ version: '10' }).setToken(
); );
logger.info('Started refreshing application (/) bot commands.'); logger.info('Started refreshing application (/) bot commands.');
await rest.put( await rest.put(Routes.applicationCommands(process.env.DISCORD_CLIENT_ID), {
Routes.applicationCommands(process.env.DISCORD_CLIENT_ID), body: slashCommands
{ });
body: slashCommands
}
);
logger.info('Successfully refreshed application (/) bot commands.'); logger.info('Successfully refreshed application (/) bot commands.');
} catch (error) { } catch (error) {
@@ -61,25 +54,14 @@ const rest = new REST({ version: '10' }).setToken(
logger.info('Started refreshing application (/) system commands.'); logger.info('Started refreshing application (/) system commands.');
for (const systemServerGuildId of systemServerGuildIds) { for (const systemServerGuildId of systemServerGuildIds) {
logger.info( logger.info(`Refreshing system commands for guild id ${systemServerGuildId}.`);
`Refreshing system commands for guild id ${systemServerGuildId}.` await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_CLIENT_ID, systemServerGuildId), {
); body: systemCommands
await rest.put( });
Routes.applicationGuildCommands(
process.env.DISCORD_CLIENT_ID,
systemServerGuildId
),
{
body: systemCommands
}
);
} }
logger.info('Successfully refreshed application (/) system commands.'); logger.info('Successfully refreshed application (/) system commands.');
} catch (error) { } catch (error) {
logger.error( logger.error(error, 'Failed to refresh application (/) system commands.');
error,
'Failed to refresh application (/) system commands.'
);
} }
})(); })();