feat: system commands are no longer restricted to bot owner id, and can be used in list of specified guilds

This commit is contained in:
Marius Begby committed 2023-07-12 20:34:54 +02:00
1 parent 1d7d810421
commit cf5151fcd7
4 files changed
+22 -27

No files matched your search

+9 -7
View File
@@ -1,7 +1,7 @@
const fs = require('node:fs');
const logger = require('./services/logger.js');
const { REST, Routes } = require('discord.js');
const { token, clientId, systemServerGuildId } = require('./config.json');
const { token, clientId, systemServerGuildIds } = require('./config.json');
const systemCommands = [];
const systemCommandFiles = fs
@@ -27,12 +27,14 @@ const rest = new REST({ version: '10' }).setToken(token);
logger.info('Started refreshing application (/) system commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, systemServerGuildId),
{
body: systemCommands
}
);
for (const systemServerGuildId of systemServerGuildIds) {
await rest.put(
Routes.applicationGuildCommands(clientId, systemServerGuildId),
{
body: systemCommands
}
);
}
logger.info('Successfully refreshed application (/) system commands.');
} catch (error) {