mirror of
https://github.com/RavenX8/companion-module-streamer.bot-api.git
synced 2026-04-03 12:48:54 -04:00
Added an action to execute code triggers
This commit is contained in:
40
actions.js
40
actions.js
@@ -30,7 +30,7 @@ export default function (self) {
|
||||
id: 'actionArgs',
|
||||
type: 'textinput',
|
||||
label: 'Action Arguments',
|
||||
default: 0,
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
@@ -84,5 +84,43 @@ export default function (self) {
|
||||
await self.client.testCredits()
|
||||
},
|
||||
},
|
||||
runTrigger: {
|
||||
name: 'Run Code Trigger',
|
||||
options: [
|
||||
{
|
||||
id: 'trigger',
|
||||
type: 'dropdown',
|
||||
label: 'Trigger',
|
||||
default: '',
|
||||
choices: self.triggers.triggers.map((value) => ({ label: value.name, ...value })),
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
console.log('Run Trigger!', event.options.action)
|
||||
await self.client.executeCodeTrigger(event.options.trigger)
|
||||
},
|
||||
},
|
||||
runTriggerAdvanced: {
|
||||
name: 'Run Code Trigger Advanced',
|
||||
options: [
|
||||
{
|
||||
id: 'trigger',
|
||||
type: 'dropdown',
|
||||
label: 'Trigger',
|
||||
default: '',
|
||||
choices: self.triggers.triggers.map((value) => ({ label: value.name, ...value })),
|
||||
},
|
||||
{
|
||||
id: 'triggerArgs',
|
||||
type: 'textinput',
|
||||
label: 'Trigger Arguments',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
callback: async (event) => {
|
||||
console.log('Run Trigger!', event.options.action)
|
||||
await self.client.executeCodeTrigger(event.options.trigger, event.options.triggerArgs)
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
4
main.js
4
main.js
@@ -15,6 +15,7 @@ class ModuleInstance extends InstanceBase {
|
||||
this.config = {}
|
||||
this.credits = {}
|
||||
this.actions = []
|
||||
this.triggers = []
|
||||
this.activeViewers = 0
|
||||
this.dataArray = []
|
||||
}
|
||||
@@ -55,6 +56,9 @@ class ModuleInstance extends InstanceBase {
|
||||
await this.client.getActions().then((value) => {
|
||||
this.actions = value
|
||||
})
|
||||
await this.client.getCodeTriggers().then((value) => {
|
||||
this.triggers = value
|
||||
})
|
||||
await this.client.getActiveViewers().then((value) => {
|
||||
this.activeViewers = value.count
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user