Open ward opened 7 years ago
Retake-name could also use specific configuration: how often to check to retake the name.
Would also want some standard functions to check for the (required) presence of these configuration values.
Q: If not present, stop loading the bot entirely or just abandon loading that specific plugin? If the latter, is this something that can just be halted within the plugin?
Concerns this part
let stravaconfig = config.get('bot.strava');
for (let key in stravaconfig) {
if (stravaconfig[key] === null || stravaconfig[key] === undefined) {
throw new Error('Tried to load strava plugin, but credentials are not present: ' + JSON.stringify(stravaconfig));
}
}
Along the lines of what a plugin should then put near the start of its script:
let account = plugin.requires('account');
let time = plugin.accepts('time', 'some default value');
If a requires()
call fails (turns out there is no such information), then loading the script should halt, an error should be printed, but the bot should carry on without that plugin.
Twitter and strava plugins require API access information. This should be somehow defined in the plugin list but requires some rethinking of that part of the configuration.