updated to es2020
This commit is contained in:
36
dist/discord.js
vendored
36
dist/discord.js
vendored
@@ -1,17 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.registerCommands = void 0;
|
||||
const rest_1 = require("@discordjs/rest");
|
||||
const v9_1 = require("discord-api-types/v9");
|
||||
// list of commands to register with discord
|
||||
const commands = [
|
||||
{
|
||||
name: 'queue',
|
||||
@@ -60,20 +52,18 @@ const commands = [
|
||||
* @param clientId discord bot client id
|
||||
* @param guildIds discord guild id(s)
|
||||
*/
|
||||
function registerCommands(token, clientId, guildIds) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const rest = new rest_1.REST({ version: '9' }).setToken(token);
|
||||
if (typeof guildIds === 'string')
|
||||
guildIds = [guildIds];
|
||||
for (let i = 0; i < guildIds.length; i++) {
|
||||
try {
|
||||
yield rest.put(v9_1.Routes.applicationGuildCommands(clientId, guildIds[i]), { body: commands });
|
||||
console.log(`[${guildIds[i]}] registered command`);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
async function registerCommands(token, clientId, guildIds) {
|
||||
const rest = new rest_1.REST({ version: '9' }).setToken(token);
|
||||
if (typeof guildIds === 'string')
|
||||
guildIds = [guildIds];
|
||||
for (let i = 0; i < guildIds.length; i++) {
|
||||
try {
|
||||
await rest.put(v9_1.Routes.applicationGuildCommands(clientId, guildIds[i]), { body: commands });
|
||||
console.log(`[${guildIds[i]}] registered command`);
|
||||
}
|
||||
});
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.registerCommands = registerCommands;
|
||||
|
||||
Reference in New Issue
Block a user