NamVr / DiscordBot-Template

A boilerplate / template for discord.js v14 bots with 100% coverage of Discord API, command handler, error handler based on https://discordjs.guide/
https://djs.docs.namanvrati.me/
Apache License 2.0
322 stars 75 forks source link

[HELP] command permissions #14

Closed kingpin24 closed 2 years ago

kingpin24 commented 2 years ago

How can you set role permissions for command usage? I'm not able to find it in the example ones except for ownerOnly

thanks

NamVr commented 2 years ago

Please briefly describe the issue. Is it a legacy based command or slash command?

kingpin24 commented 2 years ago

legacy command, i want to make it so that in the command file, certain roles can be specified such that only those roles can use the command

NamVr commented 2 years ago

I'm sorry for the late reply (didn't got notified on your reply). So you want a command property to check specific roles, or you want to check roles for just a single command inside the command code itself?

Sorry for making it complicated, first of all - it is possible with no doubts. But if you are doing it, then your command may crash on other servers since a role ID can be only of a single server (if you get what I mean)

NamVr commented 2 years ago

So if I understand, your bot is a specific server bot for just one server, then making a command property will be pog for less code complications. I'll give you a hint to get started - Go to events/messageCreate.js and like other command property definition and codes, make your own property. You can take infinite hints from the rest of the code. Good luck!

NamVr commented 2 years ago

Reach me out on discord support server for faster communication, links in issue tab - discord. If you need any more help, let me know. Meanwhile I'll close the issue.