Restrict slash cmds to admins and me

How would i make my slash commands only be available to admins of a server and to me? heres my slash cmd code
require('dotenv').config();
const { REST, Routes, ApplicationCommandOptionType } = require('discord.js');

const commands = [
{
name: 'log-channel',
description: 'Sets chosen Channel as Log Channel',
options: [
{
name: 'channel',
description: 'Choose the channel you want logs to be in',
type: ApplicationCommandOptionType.Channel,
channel_types: [0],
required: true,
},
],
},
{
name: 'logs',
description: 'Replies with current log channel',
},
];
require('dotenv').config();
const { REST, Routes, ApplicationCommandOptionType } = require('discord.js');

const commands = [
{
name: 'log-channel',
description: 'Sets chosen Channel as Log Channel',
options: [
{
name: 'channel',
description: 'Choose the channel you want logs to be in',
type: ApplicationCommandOptionType.Channel,
channel_types: [0],
required: true,
},
],
},
{
name: 'logs',
description: 'Replies with current log channel',
},
];
discord.js: 14.13.0 node: 20.5.1
9 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
dank mr panda
dank mr pandaOP2y ago
how would i make it so that i can access the command too? in servers that i dont have admin in @Qjuh its to set the channel the bot's outputs aregoing to be in i made it only to admin so normal ppl can access it but i dont have admin perms so :/ o well il just ask them to change the bot server settings oh yea huh good point so i was testing it with my alt and realized that the discord settings cant override the default perms of the bot for some reason
dank mr panda
dank mr pandaOP2y ago
dank mr panda
dank mr pandaOP2y ago
any help on why this happens? i restarted my alt's discord and mine, still doesnt work the cmd isnt showing up on the alt's side lemme check wait how would u change a single member's perms or do i have to create a role for that
dank mr panda
dank mr pandaOP2y ago
dank mr panda
dank mr pandaOP2y ago
thsi is for the @everyone role not sure why it doesnt override the perms for the bot..
dank mr panda
dank mr pandaOP2y ago
this is wut i have
dank mr panda
dank mr pandaOP2y ago
oh.
dank mr panda
dank mr pandaOP2y ago
ive gotta manually add them got it thank you!

Did you find this page helpful?