generated from bitfocus/companion-module-template-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedbacks.js
76 lines (71 loc) · 2.08 KB
/
feedbacks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const { combineRgb } = require('@companion-module/base')
module.exports = function (self) {
self.setFeedbackDefinitions({
talkActive: {
type: 'boolean',
name: 'Talking Status',
id: 'talkActive',
defaultStyle: {
// The default style change for a boolean feedback
// The user will be able to customise these values as well as the fields that will be changed
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
// options is how the user can choose the condition the feedback activates for
options: [
{
type: 'dropdown',
label: 'Channel',
id: 'channel',
choices: self.channelChoices,
},
],
callback: (feedback) => {
self.log('info', 'Checking talk feedback')
if (
self.state === undefined ||
self.state[feedback.options.channel] === undefined ||
self.state[feedback.options.channel].talking === undefined
) {
self.log('warn', 'Talking state is undefined')
return false
}
self.log('info', "Updating talking feedback")
return self.state[feedback.options.channel].talking
},
},
listenActive: {
type: 'boolean',
name: 'Listening Status',
id: 'listenActive',
defaultStyle: {
// The default style change for a boolean feedback
// The user will be able to customise these values as well as the fields that will be changed
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
// options is how the user can choose the condition the feedback activates for
options: [
{
type: 'dropdown',
label: 'Channel',
id: 'channel',
choices: self.channelChoices,
},
],
callback: (feedback) => {
self.log('info', 'Checking listen feedback')
if (
self.state === undefined ||
self.state[feedback.options.channel] === undefined ||
self.state[feedback.options.channel].listening === undefined
) {
self.log('warn', 'Listen state is undefined')
return false
}
self.log('info', 'Updating listen feedback')
return self.state[feedback.options.channel].listening
},
},
})
}