mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add member to the Automod context for mod action triggers
This commit is contained in:
parent
72459e1d93
commit
abdf54e134
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { AutomodContext, AutomodPluginType } from "../types";
|
import { AutomodContext, AutomodPluginType } from "../types";
|
||||||
import { runAutomod } from "../functions/runAutomod";
|
import { runAutomod } from "../functions/runAutomod";
|
||||||
import { resolveUser, UnknownUser } from "../../../utils";
|
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
||||||
import { ModActionType } from "../../ModActions/types";
|
import { ModActionType } from "../../ModActions/types";
|
||||||
|
|
||||||
export async function runAutomodOnModAction(
|
export async function runAutomodOnModAction(
|
||||||
|
@ -11,11 +11,15 @@ export async function runAutomodOnModAction(
|
||||||
reason?: string,
|
reason?: string,
|
||||||
isAutomodAction: boolean = false,
|
isAutomodAction: boolean = false,
|
||||||
) {
|
) {
|
||||||
const user = await resolveUser(pluginData.client, userId);
|
const [user, member] = await Promise.all([
|
||||||
|
resolveUser(pluginData.client, userId),
|
||||||
|
resolveMember(pluginData.client, pluginData.guild, userId),
|
||||||
|
]);
|
||||||
|
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
user: user instanceof UnknownUser ? undefined : user,
|
user: user instanceof UnknownUser ? undefined : user,
|
||||||
|
member: member ?? undefined,
|
||||||
modAction: {
|
modAction: {
|
||||||
type: modAction,
|
type: modAction,
|
||||||
reason,
|
reason,
|
||||||
|
|
Loading…
Add table
Reference in a new issue