feat: option to trigger antiraid_level only on change (#424)

Co-authored-by: Almeida <github@almeidx.dev>
This commit is contained in:
Ben Richeson 2023-12-29 07:52:43 -05:00 committed by GitHub
parent d51461ee3a
commit 8a4a2d3647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View file

@ -9,10 +9,11 @@ export async function setAntiraidLevel(
newLevel: string | null,
user?: User,
) {
const oldLevel = pluginData.state.cachedAntiraidLevel;
pluginData.state.cachedAntiraidLevel = newLevel;
await pluginData.state.antiraidLevels.set(newLevel);
runAutomodOnAntiraidLevel(pluginData, newLevel, user);
runAutomodOnAntiraidLevel(pluginData, newLevel, oldLevel, user);
const logs = pluginData.getPlugin(LogsPlugin);