za419 / CadenceBot

A Discord bot for Cadence Radio
MIT License
2 stars 1 forks source link

Live reconfiguration - Global #42

Open za419 opened 3 years ago

za419 commented 3 years ago

Allow the server admin to perform changes to the loaded configuration from Discord. This configuration is volatile - It is not saved to disk, and so it will be lost when CadenceBot restarts.

Syntax: One prefix (Cadence config) puts us into a configuration flow (thus only needing to check once for admin rights), then the remainder of the command describes what shall be done:

Examples:

  1. Cadence config set "customCommands.equalTo.Cadence say hello.response" "Hello World!"
    • Prints Previously undefined
    • Afterwards, anyone may send Cadence say hello and receive the response Hello World!
  2. Cadence config get logging.level
    • Prints 'logging.level is info'
  3. Cadence config delete "customCommands.targeted.Cadence echo to"
    • Prints Deleted, was previously <insert JSON blob here>
    • Afterwards, Cadence echo to will not trigger any response.
  4. Cadence config append "customCommands.Cadence flip a coin.random" Edge...?
    • Prints Added one value, array now contains 3 values.
    • Afterwards, Cadence flip a coin will produce the response Edge...? with probability ideally one third (RNG-dependent)
  5. Cadence config list
    • Prints a massive JSON blob, equivalent to running Cadence config as of this issue's opening.
kenellorando commented 3 years ago

@za419 ~Suggestion: I see use in a Cadence config reset command-- something to restore a config file back to a default state (so the bot doesn't have to be restarted to clear any Intelligent configurations). Is this possible?~

kenellorando commented 3 years ago

Oh, it's already proposed in #43. Disregard last.

za419 commented 3 years ago

Yes, the scope for this is such that config changes are potentially very short-lived - Since this is only runnable by the instance admin, and these changes don't save to disk, reset isn't really necessary - If I screw up badly enough that I need to restore, it's probably acceptable to just restart the bot.

This is essentially the base, not all that useful, skeleton upon which this whole idea of "Let CadenceBot be personalized to servers!" gets built on.