try {
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: [],
});
const allGuildIds = await client.guilds.cache.map((guild) => guild.id);
await allGuildIds.forEach((guildId) => {
rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, guildId),
{
body: [],
}
);
});
console.log(
`π Started refreshing ${commands.length} application commands...`
);
// THIS WORKS
const data = await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID
),
{
body: commands,
}
);
// THIS DOES NOT WORK
// const data = await rest.put(
// Routes.applicationCommands(process.env.CLIENT_ID),
// {
// body: commands,
// }
// );
console.log(
`β
Successfully refreshed ${data.length} application commands!`
);
} catch (err) {
console.log(`There was an error: ${err}`);
}
try {
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: [],
});
const allGuildIds = await client.guilds.cache.map((guild) => guild.id);
await allGuildIds.forEach((guildId) => {
rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, guildId),
{
body: [],
}
);
});
console.log(
`π Started refreshing ${commands.length} application commands...`
);
// THIS WORKS
const data = await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID
),
{
body: commands,
}
);
// THIS DOES NOT WORK
// const data = await rest.put(
// Routes.applicationCommands(process.env.CLIENT_ID),
// {
// body: commands,
// }
// );
console.log(
`β
Successfully refreshed ${data.length} application commands!`
);
} catch (err) {
console.log(`There was an error: ${err}`);
}