[mastodon-client] fix mentions
This commit is contained in:
parent
034e1aeb14
commit
1aad110cb9
|
@ -1257,7 +1257,14 @@ export default class Misskey implements MegalodonInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getMentions(text: string, cache: AccountCache): Promise<Entity.Mention[]> {
|
public async getMentions(text: string, cache: AccountCache): Promise<Entity.Mention[]> {
|
||||||
|
console.log(`getting mentions for message: '${text}'`);
|
||||||
const mentions :Entity.Mention[] = [];
|
const mentions :Entity.Mention[] = [];
|
||||||
|
|
||||||
|
if (text == undefined)
|
||||||
|
return mentions;
|
||||||
|
|
||||||
|
console.log('text is not undefined, continuing');
|
||||||
|
|
||||||
const mentionMatch = text.matchAll(/(?<=^|\s)@(?<user>.*?)(?:@(?<host>.*?)|)(?=\s|$)/g);
|
const mentionMatch = text.matchAll(/(?<=^|\s)@(?<user>.*?)(?:@(?<host>.*?)|)(?=\s|$)/g);
|
||||||
|
|
||||||
for (const m of mentionMatch) {
|
for (const m of mentionMatch) {
|
||||||
|
@ -1277,6 +1284,8 @@ export default class Misskey implements MegalodonInterface {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`mentions collected: ${mentions.length}`);
|
||||||
|
|
||||||
return mentions;
|
return mentions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue