Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to clear all slash commands

require('dotenv').config();

const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const token = process.env.TOKEN;
const clientId = process.env.CLIENT_ID;
const guildId = process.env.TEST_GUILD_ID;
    
const rest = new REST({ version: '9' }).setToken(token);
rest.get(Routes.applicationGuildCommands(clientId, guildId))
    .then(data => {
        const promises = [];
        for (const command of data) {
            const deleteUrl = `${Routes.applicationGuildCommands(clientId, guildId)}/${command.id}`;
            promises.push(rest.delete(deleteUrl));
        }
        return Promise.all(promises);
    });
Comment

PREVIOUS NEXT
Code Example
Javascript :: opposite number js 
Javascript :: how to give index in query selector in js 
Javascript :: django csrf failed ajax 
Javascript :: coderbyte find intersection solutions 
Javascript :: dynamic array of months js 
Javascript :: how a message persist in the localstorage in javascript 
Javascript :: node.js process.argv 
Javascript :: string.length 
Javascript :: javascript switch syntax 
Javascript :: leaflet geojson style stroke width 
Javascript :: opacity material ui 
Javascript :: 30 mins 24 hours jquery loop 
Javascript :: .env file example react native 
Javascript :: Add select option by using <a in AngularJS 
Javascript :: mongoose encrypt database using mongoose encrypt package 
Javascript :: get image from s3 bucket angular 
Javascript :: if operator ternary 
Javascript :: jquery get table 
Javascript :: vue slice words 
Javascript :: image load fail event html 
Javascript :: react clear input after button click 
Javascript :: javascript loading animation 
Javascript :: select div with clas 
Javascript :: includes in javascript 
Javascript :: jquery async await $.getScript( 
Javascript :: how to check for special charaters with spaces javascript 
Javascript :: how to send dm to every member in discord with discord.js 
Javascript :: Angular p-dialog 
Javascript :: calculate time in seconds javascript angular 
Javascript :: find the max number in an array js 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =