mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Improve antiraid trigger automod logs
This commit is contained in:
parent
3afc95c858
commit
2e5224124f
3 changed files with 10 additions and 3 deletions
|
@ -1,13 +1,19 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { User } from "eris";
|
||||
|
||||
export async function runAutomodOnAntiraidLevel(pluginData: GuildPluginData<AutomodPluginType>, level: string | null) {
|
||||
export async function runAutomodOnAntiraidLevel(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
level: string | null,
|
||||
user?: User,
|
||||
) {
|
||||
const context: AutomodContext = {
|
||||
timestamp: Date.now(),
|
||||
antiraid: {
|
||||
level,
|
||||
},
|
||||
user,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(async () => {
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function setAntiraidLevel(
|
|||
pluginData.state.cachedAntiraidLevel = newLevel;
|
||||
await pluginData.state.antiraidLevels.set(newLevel);
|
||||
|
||||
runAutomodOnAntiraidLevel(pluginData, newLevel);
|
||||
runAutomodOnAntiraidLevel(pluginData, newLevel, user);
|
||||
|
||||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ export const AntiraidLevelTrigger = automodTrigger<AntiraidLevelTriggerResult>()
|
|||
},
|
||||
|
||||
renderMatchInformation({ matchResult, pluginData, contexts, triggerConfig }) {
|
||||
return `Antiraid level was set to ...`;
|
||||
const newLevel = contexts[0].antiraid!.level;
|
||||
return newLevel ? `Antiraid level was set to ${newLevel}` : `Antiraid was turned off`;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue