refactor: extract repost filter to Util.isTextRepost

resolve https://github.com/v0l/snort/pull/314\#discussion_r1108279333
This commit is contained in:
kPherox
2023-02-16 20:42:31 +09:00
parent dfa2bf5873
commit 615c2a974a
5 changed files with 14 additions and 15 deletions

View File

@ -191,3 +191,8 @@ export function getNewest(rawNotes: TaggedRawEvent[]) {
return notes[0];
}
}
export function isTextRepost(note: TaggedRawEvent, id?: u256): (tag: string[], i: number) => boolean {
return (tag, i) =>
tag[0] === "e" && tag[3] === "mention" && note.content === `#[${i}]` && (id ? tag[1] === id : true);
}