Execute scripts on airdcpp-api events/hooks or cron schedule.
npm install airdcpp-runscript-extensionExtension to execute scripts (JavaScript) on certain events/hooks provided by the AirDC++ Web Client or controlled by cron statement.
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.
Scripts are currently executed by wrapping them in a AsyncFunction object.
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:
``javascript
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
}
``
[build-badge]: https://img.shields.io/travis/zersetz-end/airdcpp-runscript-extension/master.svg?style=flat-square
[build]: https://travis-ci.com/zersetz-end/airdcpp-runscript-extension
[npm-badge]: https://img.shields.io/npm/v/airdcpp-runscript-extension.svg?style=flat-square
[npm]: https://www.npmjs.com/package/airdcpp-runscript-extension