This commit is contained in:
ThatOneCalculator 2023-09-19 17:14:01 -07:00
parent 5964a10571
commit 414f6df104
No known key found for this signature in database
GPG Key ID: 8703CACD01000000

View File

@ -204,14 +204,7 @@ export const NoteRepository = db.getRepository(Note).extend({
host, host,
); );
let lang; const lang = detectLanguage_(`${note.cw ?? ''}\n${note.text ?? ''}`) ?? "unknown"
try {
lang = (detectLanguage_((note.text || "") + (note.cw || "")))
.languages[0].code;
} catch (e) {
lang =
detect((note.text || "") + (note.cw || ""))?.[0]?.lang || "unknown";
}
const reactionEmoji = await populateEmojis(reactionEmojiNames, host); const reactionEmoji = await populateEmojis(reactionEmojiNames, host);
const packed: Packed<"Note"> = await awaitAll({ const packed: Packed<"Note"> = await awaitAll({
id: note.id, id: note.id,