mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 20:55:01 +00:00
More fixes, change rest of stripObjectToScalars to configAccessibleObj
This commit is contained in:
parent
4ad99975de
commit
acb4913495
66 changed files with 623 additions and 192 deletions
|
@ -1,4 +1,4 @@
|
|||
import { GuildMember, TextChannel } from "discord.js";
|
||||
import { GuildMember, TextChannel, ThreadChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { hasPermission } from "knub/dist/helpers";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -19,7 +19,7 @@ export async function actualKickMemberCmd(
|
|||
reason: string;
|
||||
mod: GuildMember;
|
||||
notify?: string;
|
||||
"notify-channel"?: TextChannel;
|
||||
"notify-channel"?: TextChannel | ThreadChannel;
|
||||
clean?: boolean;
|
||||
},
|
||||
) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GuildMember, Message, TextChannel, User } from "discord.js";
|
||||
import { GuildMember, Message, TextChannel, ThreadChannel, User } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { logger } from "../../../logger";
|
||||
|
@ -19,7 +19,13 @@ export async function actualMuteUserCmd(
|
|||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
user: User | UnknownUser,
|
||||
msg: Message,
|
||||
args: { time?: number; reason?: string; mod: GuildMember; notify?: string; "notify-channel"?: TextChannel },
|
||||
args: {
|
||||
time?: number;
|
||||
reason?: string;
|
||||
mod: GuildMember;
|
||||
notify?: string;
|
||||
"notify-channel"?: TextChannel | ThreadChannel;
|
||||
},
|
||||
) {
|
||||
// The moderator who did the action is the message author or, if used, the specified -mod
|
||||
let mod: GuildMember = msg.member!;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { DiscordAPIError, Snowflake, User } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { logger } from "../../../logger";
|
||||
|
@ -129,8 +130,8 @@ export async function banUserId(
|
|||
const mod = await resolveUser(pluginData.client, modId);
|
||||
const logtype = banTime ? LogType.MEMBER_TIMED_BAN : LogType.MEMBER_BAN;
|
||||
pluginData.state.serverLogs.log(logtype, {
|
||||
mod: stripObjectToScalars(mod),
|
||||
user: stripObjectToScalars(user),
|
||||
mod: userToConfigAccessibleUser(mod),
|
||||
user: userToConfigAccessibleUser(user),
|
||||
caseNumber: createdCase.case_number,
|
||||
reason,
|
||||
banTime: banTime ? humanizeDuration(banTime) : null,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { GuildMember } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { renderTemplate } from "../../../templateFormatter";
|
||||
|
@ -40,7 +41,7 @@ export async function kickMember(
|
|||
guildName: pluginData.guild.name,
|
||||
reason,
|
||||
moderator: kickOptions.caseArgs?.modId
|
||||
? stripObjectToScalars(await resolveUser(pluginData.client, kickOptions.caseArgs.modId))
|
||||
? userToConfigAccessibleUser(await resolveUser(pluginData.client, kickOptions.caseArgs.modId))
|
||||
: {},
|
||||
});
|
||||
|
||||
|
@ -79,8 +80,8 @@ export async function kickMember(
|
|||
// Log the action
|
||||
const mod = await resolveUser(pluginData.client, modId);
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_KICK, {
|
||||
mod: stripObjectToScalars(mod),
|
||||
user: stripObjectToScalars(member.user),
|
||||
mod: userToConfigAccessibleUser(mod),
|
||||
user: userToConfigAccessibleUser(member.user),
|
||||
caseNumber: createdCase.case_number,
|
||||
reason,
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@ import { GuildPluginData } from "knub";
|
|||
import moment from "moment-timezone";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { logger } from "src/logger";
|
||||
import { userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { resolveUser, SECONDS, stripObjectToScalars } from "../../../utils";
|
||||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||
|
@ -57,7 +58,7 @@ export async function outdatedTempbansLoop(pluginData: GuildPluginData<ModAction
|
|||
// Log the unban
|
||||
const banTime = moment(tempban.created_at).diff(moment(tempban.expires_at));
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_TIMED_UNBAN, {
|
||||
mod: stripObjectToScalars(await resolveUser(pluginData.client, tempban.mod_id)),
|
||||
mod: userToConfigAccessibleUser(await resolveUser(pluginData.client, tempban.mod_id)),
|
||||
userId: tempban.user_id,
|
||||
caseNumber: createdCase.case_number,
|
||||
reason,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { TextChannel, ThreadChannel } from "discord.js";
|
||||
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
|
||||
|
||||
export function readContactMethodsFromArgs(args: {
|
||||
notify?: string;
|
||||
"notify-channel"?: TextChannel;
|
||||
"notify-channel"?: TextChannel | ThreadChannel;
|
||||
}): null | UserNotificationMethod[] {
|
||||
if (args.notify) {
|
||||
if (args.notify === "dm") {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { GuildMember, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { memberToConfigAccessibleMember, userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { renderTemplate } from "../../../templateFormatter";
|
||||
|
@ -30,7 +31,7 @@ export async function warnMember(
|
|||
guildName: pluginData.guild.name,
|
||||
reason,
|
||||
moderator: warnOptions.caseArgs?.modId
|
||||
? stripObjectToScalars(await resolveUser(pluginData.client, warnOptions.caseArgs.modId))
|
||||
? userToConfigAccessibleUser(await resolveUser(pluginData.client, warnOptions.caseArgs.modId))
|
||||
: {},
|
||||
});
|
||||
const contactMethods = warnOptions?.contactMethods
|
||||
|
@ -77,8 +78,8 @@ export async function warnMember(
|
|||
|
||||
const mod = await pluginData.guild.members.fetch(modId as Snowflake);
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_WARN, {
|
||||
mod: stripObjectToScalars(mod),
|
||||
member: stripObjectToScalars(member, ["user", "roles"]),
|
||||
mod: memberToConfigAccessibleMember(mod),
|
||||
member: memberToConfigAccessibleMember(member),
|
||||
caseNumber: createdCase.case_number,
|
||||
reason,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue