mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 13:27:31 -07:00
[mastodon-client] Fail gracefully if user resolve fails
This commit is contained in:
parent
16df0dd9db
commit
acff402e21
1 changed files with 14 additions and 14 deletions
|
@ -1257,17 +1257,15 @@ 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)
|
if (text == undefined)
|
||||||
return mentions;
|
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) {
|
||||||
|
try {
|
||||||
if (m.groups == null)
|
if (m.groups == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1283,6 +1281,8 @@ export default class Misskey implements MegalodonInterface {
|
||||||
acct: account.acct
|
acct: account.acct
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch {}
|
||||||
|
}
|
||||||
|
|
||||||
return mentions;
|
return mentions;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue