Restructured file to allow async use

This commit is contained in:
Skylar Grant 2023-02-19 19:06:16 -05:00
parent 70c4d55cfa
commit f03314af80

View File

@ -22,7 +22,7 @@ console.log(`Token: ${token} Client ID: ${clientId}`);
const rest = new REST({ version: '9' }).setToken(token); const rest = new REST({ version: '9' }).setToken(token);
(async () => { async function deleteCommands() {
try { try {
console.log('Started deleting application (/) commands.'); console.log('Started deleting application (/) commands.');
@ -35,11 +35,11 @@ const rest = new REST({ version: '9' }).setToken(token);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
})(); }
(async () => { async function uploadCommands() {
try { try {
console.log('Started refreshing application (/) commands.'); console.log('Started reloading application (/) commands.');
await rest.put( await rest.put(
Routes.applicationCommands(clientId), Routes.applicationCommands(clientId),
@ -51,4 +51,9 @@ const rest = new REST({ version: '9' }).setToken(token);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}
(async () => {
await deleteCommands();
await uploadCommands();
})(); })();