airdcpp-runscript-extension
v1.2.13
Published
Execute scripts on airdcpp-api events/hooks or cron schedule.
Downloads
25
Maintainers
Readme
airdcpp-runscript-extension
Extension to execute scripts (JavaScript) on certain events/hooks provided by the AirDC++ Web Client or controlled by cron statement.
Configuration
The configuration consists of 3 sections for events, hooks and schedules. Executions for the same event/hook are executed asynchronously, so the scripts should never build on one another.
Script execution
Scripts are currently executed by wrapping them in a AsyncFunction object.
Parameter
The following parameters are defined:
| Name | Type | Description | :--- | :--- | :--- | | socket | object | The Api socket | require | function | Module.require(id) function to load additional modules in the script | extension | object | The Extension entry structure | message | object | (Hook and event only) Received message | accept | function | (Hook only) Function to accept the validation (documentation) | reject | function | (Hook only) Function to reject the validation (documentation)
Resulting method signatures for each execution type:
async cron(socket, require, extension){
// your script code
}
async event(socket, require, extension, message){
// your script code
}
async hook(socket, require, extension, message, accept, reject){
// your script code
}