Skip to content
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

Allow Conditional Loading of Modules per Server #43

Closed
IanMitchell opened this issue May 27, 2016 · 11 comments
Closed

Allow Conditional Loading of Modules per Server #43

IanMitchell opened this issue May 27, 2016 · 11 comments
Labels
Core Tasks related to the Core Framework and APIs Feature Related to Aquarius commands, including new features and requests

Comments

@IanMitchell
Copy link
Owner

When Aquarius is added to a server, only a select few modules should be enabled automatically. The rest will need to be enabled by the server admin.

As part of the settings, Aquarius should also allow the restriction of modules, perhaps using the following states:

  1. ON: Anyone can use this module
  2. RESTRICTED: Only the Aquarius Mod role and server admin can use this module
  3. ADMIN: Only the server admin can use this module
  4. OFF: The module won't run on the server

Further, additional configuration values should be allowable (things like API access keys and the like)

@IanMitchell IanMitchell added Feature Related to Aquarius commands, including new features and requests Core Tasks related to the Core Framework and APIs labels May 27, 2016
@IanMitchell IanMitchell added this to the Aquarius New Server Setup milestone May 27, 2016
This was referenced May 27, 2016
@IanMitchell
Copy link
Owner Author

Some additional notes - we'll probably need a new messaging utility. Something like

prompt('input string').then(response => ... ).catch(err => ...);

Which queries the server admin and resolves with their response. The user can respond cancel to stop the process, which throws the error that the module keys off of to clean up any activity.

We'll also want an optional setUp method per command that can prompt for keys or other such information. This can be used as an temporary whitelist/blacklist system as well, until a better one can be devised (just exporting an array of IDs?)

@IanMitchell
Copy link
Owner Author

The setup method should probably be a promise as well; the core bot can key off of a resolve to finish adding the module or a reject to send an error message. At this point, it might be prudent to switch the command files to a class system in a similar fashion to ARX-7

This was referenced Jun 3, 2016
@IanMitchell
Copy link
Owner Author

Once this is done, we should bump up the version to 1.0 and release it on NPM

@IanMitchell
Copy link
Owner Author

IanMitchell commented Jun 6, 2016

Thinking the following format might be best - maybe rename setUp to addServer?

class Command {
  constructor() {
    this.name = 'Command';
    this.serverWhitelist = [];
    this.serverBlacklist = [];
  }

  setUp() {
    return;
  }

  message() {
    return false;
  }

  helpMessage() {
    return;
  }
}

module.exports = Command;

I made helpMessage a function because I think having the option to specialize it per server is nice; for instance, you could rename "karma" to something else per server and have it reflect in the help message.

@IanMitchell
Copy link
Owner Author

IanMitchell commented Jun 6, 2016

As part of this, we need a settings table - the Schema should probably look like:

id serverID command key value
x '3423...' 'karma' 'name' 'torneritos'

@IanMitchell
Copy link
Owner Author

Actually, it might be worth combining key/value into a single config JSON field

@IanMitchell
Copy link
Owner Author

I think this might require a few extra database tables; it might be worth reorganizing what we currently have.

@IanMitchell
Copy link
Owner Author

IanMitchell commented Jun 18, 2016

Progress update: Settings and conditional command loading work. I've gotten an initial admin query system up that allows them to set config values, but I still need to add/remove all commands, clear up the messaging a bit, and clear set config values. The permissions system also isn't exposed to the admin yet

@IanMitchell
Copy link
Owner Author

Alright, status update - everything is done except for:

  • Update Karma to read from settings
  • New server created message
  • Create admin command to automatically create Aquarius Roles

@IanMitchell
Copy link
Owner Author

IanMitchell commented Jun 23, 2016

Issues found:

  • After adding all commands, a help displays an empty list of available commands
  • Karma is broken (try to retrieve when none is set, the settings is broken when you try to increase)
  • Help not displayed for all commands (module not found)

@IanMitchell
Copy link
Owner Author

Done and merged in 8256f76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Tasks related to the Core Framework and APIs Feature Related to Aquarius commands, including new features and requests
Projects
None yet
Development

No branches or pull requests

1 participant