From 1aad110cb900db1e0176efcf2e558bb5d31ea321 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 6 Jul 2023 01:44:29 +0200 Subject: [PATCH] [mastodon-client] fix mentions --- packages/megalodon/src/misskey.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index cc9447868a..169c3af9d1 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -1257,7 +1257,14 @@ export default class Misskey implements MegalodonInterface { } public async getMentions(text: string, cache: AccountCache): Promise { - const mentions :Entity.Mention[] = []; + console.log(`getting mentions for message: '${text}'`); + const mentions :Entity.Mention[] = []; + + if (text == undefined) + return mentions; + + console.log('text is not undefined, continuing'); + const mentionMatch = text.matchAll(/(?<=^|\s)@(?.*?)(?:@(?.*?)|)(?=\s|$)/g); for (const m of mentionMatch) { @@ -1277,6 +1284,8 @@ export default class Misskey implements MegalodonInterface { }); } + console.log(`mentions collected: ${mentions.length}`); + return mentions; }