3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00

format: Prettier

This commit is contained in:
Jonathan 2021-04-02 23:19:38 -04:00
parent 70be2a2055
commit 517ce4f52f
No known key found for this signature in database
GPG key ID: 19B04E3CBE0885B1
161 changed files with 534 additions and 659 deletions

View file

@ -108,8 +108,8 @@ export async function logAndDetectMessageSpam(
// Get the offending message IDs
// We also get the IDs of any messages after the last offending message, to account for lag before detection
const savedMessages = recentActions.map(a => a.extraData as SavedMessage);
const msgIds = savedMessages.map(m => m.id);
const savedMessages = recentActions.map((a) => a.extraData as SavedMessage);
const msgIds = savedMessages.map((m) => m.id);
const lastDetectedMsgId = msgIds[msgIds.length - 1];
const additionalMessages = await pluginData.state.savedMessages.getUserMessagesByChannelAfterId(
@ -117,11 +117,11 @@ export async function logAndDetectMessageSpam(
savedMessage.channel_id,
lastDetectedMsgId,
);
additionalMessages.forEach(m => msgIds.push(m.id));
additionalMessages.forEach((m) => msgIds.push(m.id));
// Then, if enabled, remove the spam messages
if (spamConfig.clean !== false) {
msgIds.forEach(id => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
msgIds.forEach((id) => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
pluginData.client.deleteMessages(savedMessage.channel_id, msgIds).catch(noop);
}
@ -129,7 +129,7 @@ export async function logAndDetectMessageSpam(
const uniqueMessages = Array.from(new Set([...savedMessages, ...additionalMessages]));
uniqueMessages.sort((a, b) => (a.id > b.id ? 1 : -1));
const lastHandledMsgId = uniqueMessages
.map(m => m.id)
.map((m) => m.id)
.reduce((last, id): string => {
return id > last ? id : last;
});
@ -191,7 +191,7 @@ export async function logAndDetectMessageSpam(
});
}
},
err => {
(err) => {
logger.error(`Error while detecting spam:\n${err}`);
},
);