From 55f38a3cb1f79d979ff4e28168814f9155a557ca Mon Sep 17 00:00:00 2001 From: Coow Date: Fri, 22 Sep 2023 03:57:10 +0200 Subject: [PATCH] Changed response to be more dynamic, depending on settings --- src/extension/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/extension/index.ts b/src/extension/index.ts index e44d321..dc68c8a 100644 --- a/src/extension/index.ts +++ b/src/extension/index.ts @@ -4,17 +4,23 @@ module.exports = function (nodecg: NodeCG.ServerAPI) { const caster1 = nodecg.Replicant('caster1'); const caster2 = nodecg.Replicant('caster2'); const observer = nodecg.Replicant('observer'); + const showobserver = nodecg.Replicant('showobserver'); const router = nodecg.Router(); router.get('/casters', (req, res) => { - res.send(`Todays casters: Left: ${caster1.value} & Right: ${caster2.value}! Observer: ${observer.value}`); + let response = `Todays casters: Left: ${caster1.value} & Right: ${caster2.value}!` + {showobserver.value ? response += `Observer: ${observer.value}` : ''} + res.send(response); }); router.get('/observer', (req, res) => { - res.send(`Todays Observer: ${observer.value}`); + let response = '' + {showobserver.value ? response = `Todays Observer: ${observer.value}` : response = 'No dedicated observer today :('} + + res.send(response); }); nodecg.mount('/caster', router); -}; +}; \ No newline at end of file