-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small question #103
Comments
Making these commands in a seperate group is the easiest way to do this: group: 'nsfw', Then, make sure that in your index.js file, the group name is included: paths: [
'action', 'anime', 'bot',
'core', 'fun', 'moderation', 'music',
'owner', 'setup', 'social','utility', 'nsfw'
// ^ right here
] After this, you can hide the group when executing help command by filtering the group out if (command.group === 'nsfw'){
return message.channel.send('oh no, this is a nsfw command!')
}; That will work for all cases, but if you want the command to be hidden only on non-nsfw channels, you can add a condition like: if (command.group === 'nsfw' && !message.channel.nsfw){
return message.channel.send('oh no, this is a nsfw command!')
}; You can disable the nsfw command group or any command group from appearing on for (const group of Object.keys(client.commands.groups).filter(g => !['unspecified', 'nsfw'].includes(g)))
// ^ group name to exclude here |
I've tried applying the last line for cmd.js, and instead of using if-else to hide the NSFW category in non-NSFW channels, I wanna know if I can use something else shorter? |
I might send the code if you wish. |
If you mean to display the nsfw commands in a nsfw channel, you can add a condition in the filter without using if-else // Excludes nsfw on all channels
for (const group of Object.keys(client.commands.groups).filter(g => !['unspecified', 'nsfw'].includes(g)))
// ^ group name to exclude here
// Excludes nsfw on all channels except nsfw
const filternsfw = (nsfw) => nsfw === 'nsfw' ? message.channel.nsfw ? true : false : true;
// nsfw === 'nsfw' -> Checks if the group name is nsfw
// message.channel.nsfw -> Checks if the channel is nsfw
// true -> Do not filter out if the channel is not nsfw
// false -> Filter out if group name is nsfw and channel is nsfw
// true -> Do not filter out if group name is not nsfw
for (const group of Object.keys(client.commands.groups).filter(g => g !== 'unspecified' || filternsfw(g))){
// ^ use the function here I have not tested the code on the local machine, but the logic should work |
Doesn't seem to work, actually. I guess I'll use if-else for that. |
Thanks for your help! |
Uh, if I try to make some sort of NSFW commands in a separate group, how can I hide it when executing m!help in non-NSFW channels?
(I know this question is silly, meh)
The text was updated successfully, but these errors were encountered: