Automod actions + ModActions public interface

This commit is contained in:
Dragory 2020-07-28 21:34:01 +03:00
parent 0f0728bc1c
commit 86023877a2
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
22 changed files with 508 additions and 16 deletions

View file

@ -0,0 +1,12 @@
import { PluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RECENT_NICKNAME_CHANGE_EXPIRY_TIME, RECENT_SPAM_EXPIRY_TIME } from "../constants";
export function clearOldRecentNicknameChanges(pluginData: PluginData<AutomodPluginType>) {
const now = Date.now();
for (const [userId, { timestamp }] of pluginData.state.recentNicknameChanges) {
if (timestamp + RECENT_NICKNAME_CHANGE_EXPIRY_TIME <= now) {
pluginData.state.recentNicknameChanges.delete(userId);
}
}
}