Portal-Mapping-And-Modding / PMAM-Bot-The-Watcher

The discord.py bot used in the Portal Mapping and Modding Discord server named The Watcher.
GNU Affero General Public License v3.0
1 stars 0 forks source link

Commands should only be visible by certain roles #7

Closed TheEndKing11 closed 1 week ago

TheEndKing11 commented 1 week ago

You can make this happen with:

client.on('message', async message => { // Check if the user has a role with the name "Admin" if (message.member.roles.find(r => r.name === 'Admin')){ if (message.content === 'foo') { // do stuff... } else if (message.content === 'bar') { // do more stuff.. } } });

More information available here: https://stackoverflow.com/questions/70812006/discord-js-how-can-i-make-this-command-only-work-for-certain-roles-users

OrsellGaming commented 1 week ago

What you're suggesting is not possible. The bot is using discord.py, not discord.js. Plus, there are already some checks for who can execute what. The current code the bot is running has yet to have them all but the dev branch does have most in place already. It still needs some work before being used in a production setting.