From 466e441d81ba5e441a557011d281cdff2ee70ed6 Mon Sep 17 00:00:00 2001 From: Antoine Kingue Date: Mon, 18 Dec 2023 17:20:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20titles=20filter=20(#28)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/three-wasps-collect.md | 5 +++++ packages/dixt-plugin-twitch/src/index.ts | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .changeset/three-wasps-collect.md diff --git a/.changeset/three-wasps-collect.md b/.changeset/three-wasps-collect.md new file mode 100644 index 0000000..7123996 --- /dev/null +++ b/.changeset/three-wasps-collect.md @@ -0,0 +1,5 @@ +--- +"dixt-plugin-twitch": patch +--- + +Add titles filter diff --git a/packages/dixt-plugin-twitch/src/index.ts b/packages/dixt-plugin-twitch/src/index.ts index e5d15b1..452fa2d 100644 --- a/packages/dixt-plugin-twitch/src/index.ts +++ b/packages/dixt-plugin-twitch/src/index.ts @@ -17,6 +17,7 @@ dotenv.config({ export type DixtPluginTwitchOptions = { channel?: string; roles?: string[]; + titles?: string[]; games?: string[]; messages?: { isStreaming?: string; @@ -87,6 +88,16 @@ const dixtPluginTwitch: DixtPlugin = ( } } + if ( + options.titles && + activity.details && + !options.titles.some((title) => + activity.details.toLowerCase().includes(title.toLowerCase()), + ) + ) { + return; + } + // check if roles are set if (options.roles && options.roles.length > 0) { // check if member has roles