Added TTS chat filters.

This commit is contained in:
Tom
2024-12-28 01:37:44 +00:00
parent 0afa2138b4
commit 275069697f
30 changed files with 722 additions and 192 deletions

View File

@ -1,12 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PolicyComponent } from './policy/policy.component';
import { PolicyTableComponent } from './policy-table/policy-table.component';
import { PolicyAddFormComponent } from './policy-add-form/policy-add-form.component';
@NgModule({
declarations: [],
imports: [
CommonModule
PolicyComponent, PolicyTableComponent, PolicyAddFormComponent
]
})
export class PoliciesModule { }
export class PoliciesModule { }

View File

@ -1,10 +1,9 @@
import { AsyncPipe } from '@angular/common';
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Component } from '@angular/core';
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatInputModule } from '@angular/material/input';
import { Policy } from '../../shared/models/policy';
import EventService from '../../shared/services/EventService';
import { map, Observable, startWith } from 'rxjs';
import { HermesClientService } from '../../hermes-client.service';
@ -15,7 +14,7 @@ const Policies = [
{ path: "tts.chat.bits.read", description: "To read chat messages with bits via TTS" },
{ path: "tts.chat.messages.read", description: "To read chat messages via TTS" },
{ path: "tts.chat.redemptions.read", description: "To read channel point redemption messages via TTS" },
//{ path: "tts.chat.subscriptions.read", description: "To read chat messages from subscriptions via TTS" },
{ path: "tts.chat.subscriptions.read", description: "To read chat messages from subscriptions via TTS" },
{ path: "tts.commands", description: "To execute commands for TTS" },
{ path: "tts.commands.nightbot", description: "To use !nightbot command" },
{ path: "tts.commands.obs", description: "To use !obs command" },

View File

@ -19,7 +19,7 @@
</ng-container>
<ng-container matColumnDef="usage">
<th mat-header-cell *matHeaderCellDef>Usage per span</th>
<th mat-header-cell *matHeaderCellDef>Usage Rate</th>
<td mat-cell *matCellDef="let policy">
@if (policy.editing) {
<input type="number" [(ngModel)]="policy.usage" (keypress)="($event.charCode >= 48 && $event.charCode < 58)" />

View File

@ -1,7 +1,3 @@
div {
background-color: black;
}
h4 {
text-align: center;
}

View File

@ -1,10 +1,8 @@
import { Component, Inject, NgZone, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { Component, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { PolicyAddFormComponent } from "../policy-add-form/policy-add-form.component";
import { PolicyTableComponent } from "../policy-table/policy-table.component";
import { Policy, PolicyScope } from '../../shared/models/policy';
import { DatePipe, isPlatformBrowser } from '@angular/common';
import { OAuthService } from 'angular-oauth2-oidc';
import { Subscription } from 'rxjs';
import { isPlatformBrowser } from '@angular/common';
import { HermesClientService } from '../../hermes-client.service';
import { Router, RouterModule } from '@angular/router';
@ -17,14 +15,10 @@ import { Router, RouterModule } from '@angular/router';
})
export class PolicyComponent implements OnInit, OnDestroy {
private isBrowser: boolean;
private ngZone: NgZone;
private subscription: Subscription | undefined;
items: Policy[];
pipe = new DatePipe('en-US')
constructor(private client: HermesClientService, private oauthService: OAuthService, private router: Router, ngZone: NgZone, @Inject(PLATFORM_ID) private platformId: Object) {
this.ngZone = ngZone;
constructor(private client: HermesClientService, private router: Router, @Inject(PLATFORM_ID) private platformId: Object) {
this.isBrowser = isPlatformBrowser(this.platformId)
this.items = []
@ -42,12 +36,8 @@ export class PolicyComponent implements OnInit, OnDestroy {
this.router.navigate(["/tts-login"]);
return;
}
this.subscription = this.client.connect();
}
ngOnDestroy() {
if (this.subscription)
this.subscription.unsubscribe()
}
}