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

More Automod updates

This commit is contained in:
Dragory 2020-07-28 21:51:58 +03:00
parent d4078b4234
commit 62c68b99f7
13 changed files with 88 additions and 28 deletions

View file

@ -1,6 +1,9 @@
import { User } from "eris";
import { PluginData } from "knub";
import { AutomodPluginType } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars } from "../../../utils";
export async function setAntiraidLevel(
pluginData: PluginData<AutomodPluginType>,
@ -10,9 +13,16 @@ export async function setAntiraidLevel(
pluginData.state.cachedAntiraidLevel = newLevel;
await pluginData.state.antiraidLevels.set(newLevel);
const logs = pluginData.getPlugin(LogsPlugin);
if (user) {
// TODO: Log user action
logs.log(LogType.SET_ANTIRAID_USER, {
level: newLevel ?? "off",
user: stripObjectToScalars(user),
});
} else {
// TODO: Log automatic action
logs.log(LogType.SET_ANTIRAID_AUTO, {
level: newLevel ?? "off",
});
}
}