mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
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:
1 parent
1d7d810421
commit
cf5151fcd7
4 files changed
+22
-27
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user