Skip to content

Commit

Permalink
✨ add titles filter (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Dec 18, 2023
1 parent b9b3d64 commit 466e441
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-wasps-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dixt-plugin-twitch": patch
---

Add titles filter
11 changes: 11 additions & 0 deletions packages/dixt-plugin-twitch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dotenv.config({
export type DixtPluginTwitchOptions = {
channel?: string;
roles?: string[];
titles?: string[];
games?: string[];
messages?: {
isStreaming?: string;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 466e441

Please sign in to comment.