3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

fix(phisherman): reset validApiKey on 'missing permissions' error; log getDomainInfo() errors

This commit is contained in:
Dragory 2021-11-03 16:53:11 +02:00
parent fe7872888b
commit 1d5d8d96de
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -11,7 +11,14 @@ export async function getDomainInfo(
return null; return null;
} }
const info = await getPhishermanDomainInfo(domain).catch(() => null); const info = await getPhishermanDomainInfo(domain).catch((err) => {
// tslint:disable-next-line:no-console
console.warn(`[PHISHERMAN] Error in getDomainInfo() for server ${pluginData.guild.id}: ${err.message}`);
if (err.message === "missing permissions") {
pluginData.state.validApiKey = null;
}
return null;
});
if (info != null && !phishermanDomainIsSafe(info)) { if (info != null && !phishermanDomainIsSafe(info)) {
trackPhishermanCaughtDomain(pluginData.state.validApiKey, domain); trackPhishermanCaughtDomain(pluginData.state.validApiKey, domain);
} }