Fixed Permissions System, thanks Nekai

This commit is contained in:
miraai 2016-09-13 15:36:32 +02:00 committed by GitHub
parent 8982772a80
commit d0bf760a4c

View File

@ -1,60 +1,72 @@
# Overview
Ever stuck handling your Nadeko permissions? Look no further than this guide!
We'll handle a few example cases that we've seen frequently on the help channel, as well as explaining the order of permissions in general. Any command used here can be found in the [Commands list](Commands List.md#permissions)
Permissions Overview
===================
Have you ever felt confused or even overwhelmed when trying to set Nadeko's permissions? In this guide we will be explaining how to use the
permission commands correctly and even cover a few common questions! Every command we discuss here can be found in the [Commands List](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#permissions).
# How does it work?
Permissions are handy to set up to limit who in your server can use what. by default, every command is enabled for everyone, except for the administration commands, like `.kick` and `.prune`, which are set to correspond to discord's permissions, (kicking and managing messages respectively here), the permissions module, which we will show in the next paragraph, and some other commands throughout the other modules that are owner-only, meaning that only someone who has his or her id in the list of owners of the bot can use them.
Since you may not want to allow everyone to use the NSFW module, skip the current song, pick up flowers, or attack in the pokegame, you're in need of setting up permissions.
Why do we use the Permissions Commands?
------------------------------
Permissions are very handy for setting who can use what commands in your server. By default, every command is enabled for everybody, however a few exclusions are the Administration Commands like, `.kick` and `.prune` and Bot Owner-Only commands as these require your id to be in [`credentials.json`](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/ "Setting up your credentials").
With the Permission Commands it is possible to restrict who can skip the current song, pick NadekoFlowers, or even use the NSFW module.
#First time setting up
When you want to change your first permissions, you need to fulfill one of two conditions:
* Be the owner of the server
* Have the role set by `;permrole` (Nadeko by default)
First Time Setup
------------------
To change permissions you must meet one of two requirements, either:
+ **Be the Server Owner**
+ Have the role specified by `;permrole` (is Nadeko by default).
If you have neither of these, you **can't** set up permissions.
You may want to change the `;permrole` to the role of the admins, using `;permrole Admins`.
If you meet neither of these requirements, you ***can not*** edit permissions.
# Basics
Most of the commands found in the list are pretty much self-explanatory. `;rolemdl NSFW disable lurkers` would disable the NSFW module for the lurkers (let them come out of the shadows!). similarly `;chnlperms #general` would show which permissions are banned *specifically* for this channel.
Since permissions are enabled by default, the hierarchy of rulings is simple, if you disable something that affects a user, like `;sm nsfw disable`, you **can't** enable it in a particular other way, like `;cm nsfw enable #nsfw`. Now roles are an exemption to this, e.g. if all roles have music disabled except for the DJ role, you can still use music commands if you have the DJ role.
If you would like to allow Admins to edit permissions you may want to rename the `;permrole` to `;permrole Admins` and give each admin that role.
By default, the bot notifies when a command can't be used. To disable this, you can use `;verbose false`.
Basics & Heirachy
-----
Most of the commands found in the list describe what they do, but we will cover a few here.
# Common Cases
These are some common cases of particular settings of permissions.
If you would like to disable the NSFW module for a certain role you would use `;rolemdl NSFW disable SomeRole`.
## Create a music DJ
e.g. you only want your users to be able to see what's playing, and have a DJ role for the rest.
- `;arc music disable all`, disable all commands of the music module for everyone.
- `;arc music enable DJ`, give permissions to the DJ to do everything
- `;rc "!!nowplaying" enable all`, enable the command for everyone
- `;rc "!!getlink" enable all`, as above.
- `;rc "!!listqueue" enable all`, as above.
Similarly you can view which Modules and Commands are banned on a _specific_ channel with `;chnlperms SomeChannel`.
## Create a NSFW channel
You want to only allow NSFW commands in the #nsfw channel.
- `;cm nsfw disable all` disable the nsfw module in every channel.
- `;cm nsfw enable #nsfw` re-enable the nsfw module in the #nsfw channel.
The heirachy of the Permissions are simple. If you disable a Module/command with a command that affects the server, `;sm NSFW disable` you can not then enable it another way such as, `;cm NSFW enable SomeChannel`. Roles are an exemption to this, i.e if all roles except for the DJ Role have music disabled, you can still use music commands if you have the DJ Role.
The bot, by default will notify you when a command can't be used. To disable this notification simply use `;verbose false`.
-- *Thanks to @applemac for writing this guide*
Commonly Asked Questions
---------------
###How do I create a music DJ?
To allow users to only see the current song and have a DJ role for queuing follow these five steps:
#Old Guide
1. `;arc music disable all`
1. Disables all music commands for everyone.
2. `;arc music enable DJ`
1. Gives all music commands to DJ role.
3. `;rc !!nowplaying enable all`
1. Enables the "nowplaying" command for eveone.
4. `;rc !!getlink enable all`
1. Enables the "getlink" command for everyone.
5. `;rc !!listqueue enable all`
1. Enables the "listqueue" command for everyone.
###How do I create an NSFW channel?
You want to only allow NSFW commands in the #nsfw channel. - `;cm nsfw disable all` disable the nsfw module in every channel. - `;cm nsfw enable #nsfw` re-enable the nsfw module in the #nsfw channel.
_-- Thanks to @applemac for writing this guide_
Old Guide
---------
**NadekoBot's permissions can be set up to be very specific through commands in the Permissions module.**
Each command or module can be turned on or off at:
- a user level (so specific users can or cannot use a command/module)
- a role level (so only certain roles have access to certain commands/module)
- a channel level (so certain commands can be limited to certain channels, which can prevent music / trivia / NSFW spam in serious channels)
- a server level.
- The user level (so specific users can or cannot use a command/module)
- The role level (so only certain roles have access to certain commands/module)
- The channel level (so certain commands can be limited to certain channels, which can prevent music / trivia / NSFW spam in serious channels)
- The server level.
Use .modules to see a list of modules (sets of commands).
Use .commands [module_name] to see a list of commands in a certain module.
Use `.modules` to see a list of modules (sets of commands). Use `.commands [module_name]` to see a list of commands in a certain module.
Permissions use a semicolon as the prefix, so always start the command with a ;.
Permissions use a semicolon as the prefix, so always start the command with a `;`.
Follow the semicolon with the letter of the level which you want to edit.
Follow the semicolon with the letter of the level which you want to edit:
- "u" for Users.
- "r" for Roles.
- "c" for Channels.
@ -70,18 +82,20 @@ Follow that with another space and, to enable it, type one of the following: [1,
Follow that with another space and the name of the user, role, channel. (depending on the first letter you picked)
###### Examples #1
- **;rm NSFW 0 [Role_Name]** Disables the NSFW module for the role, <Role_Name>.
- **;cc "!!n" 0 [Channel_Name]** Disables skipping to the next song in the channel, <Channel_Name>.
- **;uc "!!q" 1 [User_Name]** Enables queuing of songs for the user, <User_Name>.
- **;sm Gambling 0** Disables gambling in the server.
####Examples #1
Check permissions by using the letter of the level you want to check followed by a p, and then the name of the level in which you want to check. If there is no name, it will default to yourself for users, the @everyone role for roles, and the channel in which the command is sent for channels.
- `;rm NSFW 0 [Role_Name]` Disables the NSFW module for the role,
- `;cc "!!n" 0 [Channel_Name]` Disables skipping to the next song in the channel,
- `;uc "!!q" 1 [User_Name]` Enables queuing of songs for the user,
- `;sm Gambling 0 Disables` gambling in the server.
###### Examples #2
- ;cp [Channel_Name]
- ;rp [Role_Name]
Check permissions by using the letter of the level you want to check followed by a p, and then the name of the level in which you want to check. If there is no name, it will default to yourself for users, the @everyone role for roles, and the channel in which the command is sent for channels.
Insert an **a** before the level to edit the permission for all commands / modules for all users / roles / channels / server.
####Examples #2
- `;cp [Channel_Name]`
- `;rp [Role_Name]`
Insert an "a" before the level to edit the permission for all commands / modules for all users / roles / channels / server.
Reference the Help command (-h) for more Permissions related commands.