1
0

add: Bot Trending Toggle, Hide Bot in Timeline client option

This commit is contained in:
Mar0xy
2023-10-18 07:29:16 +02:00
parent fa5cf36602
commit c21d255604
19 changed files with 90 additions and 1 deletions
@@ -20,6 +20,7 @@ class GlobalTimelineChannel extends Channel {
public static requireCredential = false;
private withRenotes: boolean;
private withFiles: boolean;
private withBots: boolean;
constructor(
private metaService: MetaService,
@@ -40,6 +41,7 @@ class GlobalTimelineChannel extends Channel {
this.withRenotes = params.withRenotes ?? true;
this.withFiles = params.withFiles ?? false;
this.withBots = params.withBots ?? true;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);
@@ -48,6 +50,7 @@ class GlobalTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (!this.withBots && note.user.isBot) return;
if (note.visibility !== 'public') return;
if (note.channelId != null) return;