diff --git a/src/backend/effects/builtin/twitch/stream-game.ts b/src/backend/effects/builtin/twitch/stream-game.ts index 4d3027056..ff96a57c3 100644 --- a/src/backend/effects/builtin/twitch/stream-game.ts +++ b/src/backend/effects/builtin/twitch/stream-game.ts @@ -5,7 +5,7 @@ import twitchApi from "../../../twitch-api/api"; import eventsManager from "../../../events/EventManager"; const model: EffectType<{ - mode: "specific" | "custom"; + mode: "specific" | "custom" | "clear"; gameId: string; gameName: string; }> = { @@ -30,6 +30,10 @@ const model: EffectType<{
+ @@ -97,11 +101,16 @@ const model: EffectType<{ await twitchApi.channels.updateChannelInformation({ gameId: event.effect.gameId }); - } else { - const categories = await twitchApi.categories.searchCategories(event.effect.gameName.trim()); + } else if (event.effect.mode === "clear" || event.effect.mode === "custom" && !event.effect.gameName) { + //user left the gamename blank + await twitchApi.channels.updateChannelInformation({ + gameId: '' + }); + } else if (event.effect.mode === "custom") { + const categories = await twitchApi.categories.searchCategories(event.effect.gameName?.trim()); if (categories?.length) { const category = - categories.find((c) => c.name.toLowerCase() === event.effect.gameName.toLowerCase()) ?? + categories.find(c => c.name.toLowerCase() === event.effect.gameName.toLowerCase()) ?? categories[0]; if (!category) { diff --git a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js index 7ea813adc..885072288 100644 --- a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js +++ b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js @@ -34,20 +34,31 @@
- - -
- -
{{$select.selected.name}}
-
-
- -
- -
{{game.name}}
-
-
-
+
+ + +
+ +
{{$select.selected.name}}
+
+
+ +
+ +
{{game.name}}
+
+
+
+
+ +
+
@@ -146,7 +157,7 @@ saveText: "Add", inputPlaceholder: "Enter a tag", validationFn: (value) => { - return new Promise(resolve => { + return new Promise((resolve) => { // Must be alphanumeric no more than 25 characters const tagRegExp = /^[a-z0-9]{1,25}$/ig; @@ -170,7 +181,7 @@ $ctrl.searchGames = function(gameQuery) { backendCommunicator.fireEventAsync("search-twitch-games", gameQuery) - .then(games => { + .then((games) => { if (games != null) { $ctrl.games = games; } @@ -184,6 +195,12 @@ } }; + $ctrl.removeCategory = function() { + $ctrl.selectedGame = null; + $ctrl.streamInfo.gameId = ''; + $ctrl.streamInfo.gameName = null; + }; + $ctrl.removeStreamTag = function(tag) { $ctrl.streamInfo.tags = $ctrl.streamInfo.tags.filter(element => tag.toLowerCase() !== element.toLowerCase()); };