mirror of
https://github.com/RavenX8/companion-module-streamer.bot-api.git
synced 2026-04-03 12:48:54 -04:00
64 lines
1.2 KiB
JavaScript
64 lines
1.2 KiB
JavaScript
const { InstanceBase, Regex, runEntrypoint, InstanceStatus } = require('@companion-module/base')
|
|
const UpgradeScripts = require('./upgrades')
|
|
const UpdateActions = require('./actions')
|
|
const UpdateFeedbacks = require('./feedbacks')
|
|
const UpdateVariableDefinitions = require('./variables')
|
|
|
|
class ModuleInstance extends InstanceBase {
|
|
constructor(internal) {
|
|
super(internal)
|
|
}
|
|
|
|
async init(config) {
|
|
this.config = config
|
|
|
|
this.updateStatus(InstanceStatus.Ok)
|
|
|
|
this.updateActions() // export actions
|
|
this.updateFeedbacks() // export feedbacks
|
|
this.updateVariableDefinitions() // export variable definitions
|
|
}
|
|
// When module gets deleted
|
|
async destroy() {
|
|
this.log('debug', 'destroy')
|
|
}
|
|
|
|
async configUpdated(config) {
|
|
this.config = config
|
|
}
|
|
|
|
// Return config fields for web config
|
|
getConfigFields() {
|
|
return [
|
|
{
|
|
type: 'textinput',
|
|
id: 'host',
|
|
label: 'Target IP',
|
|
width: 8,
|
|
regex: Regex.IP,
|
|
},
|
|
{
|
|
type: 'textinput',
|
|
id: 'port',
|
|
label: 'Target Port',
|
|
width: 4,
|
|
regex: Regex.PORT,
|
|
},
|
|
]
|
|
}
|
|
|
|
updateActions() {
|
|
UpdateActions(this)
|
|
}
|
|
|
|
updateFeedbacks() {
|
|
UpdateFeedbacks(this)
|
|
}
|
|
|
|
updateVariableDefinitions() {
|
|
UpdateVariableDefinitions(this)
|
|
}
|
|
}
|
|
|
|
runEntrypoint(ModuleInstance, UpgradeScripts)
|