mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:00:18 +00:00
Remove slash commands when ending process in Dev bot
This commit is contained in:
parent
555b4d14f0
commit
314c744527
@ -1,4 +1,7 @@
|
||||
import Discord from "discord.js";
|
||||
const { REST } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
const { token, version } = require('../config.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'SIGINT',
|
||||
@ -33,6 +36,26 @@ module.exports = {
|
||||
|
||||
client.user.setStatus('dnd');
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(token);
|
||||
if(version.includes("-dev")){
|
||||
await rest.put(
|
||||
Routes.applicationCommands(client.user.id),
|
||||
{ body: [] },
|
||||
);
|
||||
|
||||
let guilds = await client.guilds.fetch();
|
||||
guilds.forEach(async guild => {
|
||||
try {
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(client.user.id, guild.id),
|
||||
{ body: [] },
|
||||
);
|
||||
} catch (DiscordAPIError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
if(radio.done){
|
||||
process.exit();
|
||||
|
Loading…
Reference in New Issue
Block a user