Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commands / Permission Page #163

Open
pedall opened this issue Dec 10, 2018 · 5 comments
Open

Commands / Permission Page #163

pedall opened this issue Dec 10, 2018 · 5 comments
Labels
invalid This doesn't seem right

Comments

@pedall
Copy link
Collaborator

pedall commented Dec 10, 2018

There is already a commands page, currently commented out in the router.js, where all the permission regarding the commands can be set. To be able to have the commands page working properly we need the following:

Data Logic

  1. Get all current command settings from bot (already fetched anyway) and merge those with the default command settings (to be able to show all commands - also already done on the api)

  2. Reflect changes in the command permissions (enable / disable, deletion trigger on / off, exceptions for channels / roles)

  3. Remove commands from array that are the default, and save final commands array to the database (current settings will be overwritten as the whole array will be overwritten)

Component dependencies

@pedall pedall added component priority 5 enhancement New feature or request and removed component labels Dec 10, 2018
@PierreAndreis
Copy link
Owner

To be able to have the commands page working properly we need the following:

the commands page right now is not working properly?
I'm confused with the rest of the issue. Is this an enhancement or an epic?

@PierreAndreis PierreAndreis added invalid This doesn't seem right and removed enhancement New feature or request priority 5 labels Dec 11, 2018
@Skillz4Killz
Copy link
Collaborator

What if we just changed the schema and the way permissions for commands work at the moment to be separate in the schema instead of all of it being in 1 array.

So instead of message.guild.settings.settings.commands which is an array of objects holding everything;

message.guild.settings.ping.enabled is a boolean if the command is enabled
message.guild.settings.ping.triggerDeletion is a boolean of whether the command trigger should be deleted
message.guild.settings.ping.channelExceptions is an array of channel ids holding exceptions for channels.
message.guild.settings.ping.roleExceptions is an array of role ids holding exceptions per role.

This would mean we don't need to manipulate the stager at all. Remember the commands are probably the only thing that remains that is an array of objects in the rewrite atm. Everything else that is NOT a setting was decided to be moved to separate tables instead of filling the Settings up. @pedall @PierreAndreis

@PierreAndreis
Copy link
Owner

Isn't settings.commands a dynamic array? like some guilds have some commands that other guilds doesn't?
I don't like the idea of making an object, especially an object that will keep growing. I think the array is just fine, stager just needs to learn how to deal with it

@Skillz4Killz
Copy link
Collaborator

Skillz4Killz commented Dec 15, 2018

Every guild has an empty settings.commands array. When a guild edits certain settings on a command that gets edited inside this array.

commands: [
	{
		name: 'ping', // Name of the command
		msgDelete: true, // Whether to delete the command trigger message
		permission: {
			disabled: true, // Whether the command is allowed on the server
			disabledChannels: [], // Channels that do not allow this command
			disabledRoles: ["ROLE ID"], // Roles not allowed to use this command
			enabledChannels: [], // Channels that are allowed if disabled: true
			enabledRoles: [], // Roles allowed to used if disabled: true
		}
	}
]

So whenever a command is edited an object like this is thrown into that array. If an object does not exist it takes the default settings. So whenever you edit a command permission an object like this gets added to the array. @PierreAndreis

@PierreAndreis
Copy link
Owner

@Skillz4Killz that's a good design, I like it. We just need to pass the defaults to the dashboard and teach Stager how to handle arrays

@Skillz4Killz Skillz4Killz changed the title Commands / Permission Commands / Permission Page Dec 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants